Agribusiness.Web.Controllers.PersonController.DownloadPhoto C# (CSharp) Method

DownloadPhoto() public method

public DownloadPhoto ( int id ) : System.Web.Mvc.FileResult
id int
return System.Web.Mvc.FileResult
        public FileResult DownloadPhoto(int id)
        {
            byte[] photo = null;
            var contentType = "image/jpeg";

            var person = Repository.OfType<Person>().GetById(id);
            if (person.OriginalPicture != null)
            {
                photo = person.OriginalPicture;
                contentType = string.IsNullOrWhiteSpace(person.ContentType) ? contentType : person.ContentType;
            }
            else
            {
                if (person.MainProfilePicture != null)
                {
                    photo = person.MainProfilePicture;
                    contentType = string.IsNullOrWhiteSpace(person.ContentType) ? contentType : person.ContentType;
                }
            }

            return File(photo, contentType, string.Format("AgribusinessPhoto_{0}.jpg", person.FullName));
        }