public JsonResult UploadImage(PhotoViewModel photo) { photo.StudentId = Convert.ToInt32(Session["StudentId"]); photo.ServerPath = System.Web.HttpContext.Current.Server.MapPath("~/StudentImages/"); PhotoViewModel result = _service.Save<IPhotoUpload, PhotoViewModel>(photo); string data = JsonConvert.SerializeObject(result); return Json(data); }
private PhotoViewModel MapProfilePics(IPhoto profilePic) { PhotoViewModel model = new PhotoViewModel { DateAdded = profilePic.DateAdded, IsCurrent = profilePic.IsCurrent, StudentId = profilePic.StudentId, PicId = profilePic.PicId, FileName = profilePic.FileName, Caption = profilePic.Caption, }; return model; }