public ActionResult Create(FormationViewModel frmViewModel, HttpPostedFileBase fileUpload) { try { if (!ModelState.IsValid) { return(View()); } if (fileUpload != null && fileUpload.ContentLength > 0) { frmViewModel.FrmImage = ImageConverter.ConvertToBytes(fileUpload); } _repository.Add(Mapper.Map <Formation>(frmViewModel)); return(RedirectToAction("Index")); } catch (RetryLimitExceededException) { ModelState.AddModelError(string.Empty, "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(frmViewModel)); }
public void Add(Formation formation) { _FormationRepsitory.Add(formation); }