public ActionResult Create(PhotoViewModel model, HttpPostedFileBase file, Guid id) { if (ModelState.IsValid) { if (file != null || file.ContentLength != 0) { model.Id = Guid.NewGuid(); model.Url = @"/img/" + file.FileName; model.AlbumRefId = id; PhotoRepository.Add(model.ToEntity()); file.SaveAs(Path.Combine(Server.MapPath("~/img"), file.FileName)); } } return(List(id)); }