public ActionResult Member(MemberModel model) { if (ModelState.IsValid) { var member = _memberServices.GetMembers().Where(r => r.LastName == model.LastName).FirstOrDefault(); string fileName = Path.GetFileNameWithoutExtension(model.MemeberImageThumbnailUrl.FileName); string extension = Path.GetExtension(model.MemeberImageThumbnailUrl.FileName); fileName = fileName + DateTime.Now.ToString("yymmssffff") + extension; model.MemberImageUrl = fileName; fileName = Path.Combine(Server.MapPath("~/Content/Images/"), fileName); model.MemeberImageThumbnailUrl.SaveAs(fileName); var result = _memberServices.CreateMemb(model); TempData["message"] = string.Format("{0} has been saved.", model.FirstName); return(RedirectToAction("Index")); } else { var member = _memberServices.GetMembers().Select(r => r.FirstName + " " + r.LastName); return(View(model)); } }