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

GetProfilePicture() public method

public GetProfilePicture ( int id ) : System.Web.Mvc.ActionResult
id int
return System.Web.Mvc.ActionResult
        public ActionResult GetProfilePicture(int? id)
        {
            if(id != null)
            {
                var person = Repository.OfType<Person>().GetById(id.Value);

                if (person.MainProfilePicture != null)
                    return File(person.MainProfilePicture, person.ContentType ?? "image/png");
            }
            // load the default image
            var fs = new FileStream(Server.MapPath("~/Images/profilepicplaceholder.png"), FileMode.Open, FileAccess.Read);
            var img = new byte[fs.Length];
            fs.Read(img, 0, img.Length);
            fs.Close();

            return File(img, "image/png");
        }