public ActionResult UpdateInstroduction(InstroductionRequest request) { if (!ModelState.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var result = _instroductionService.UpdateInstroduction(request); if (!result) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); } return(RedirectToAction("Index", "Instroduction")); }
public bool CreateInstroduction(InstroductionRequest request) { if (request == null) { return(false); } var newItem = new Instroductions { Name = request.Name, Description = request.Description, CreatedBy = 1, CreatedDate = DateTime.Now }; _instroductionRepository.Add(newItem); return(_unitOfWork.Commit()); }
public bool UpdateInstroduction(InstroductionRequest request) { if (!request.Id.HasValue) { return(false); } var update = _instroductionRepository.GetById(request.Id.Value); if (update == null) { return(false); } update.Name = request.Name; update.Description = request.Description; update.ModifiedBy = 1; update.ModifiedDate = DateTime.Now; _instroductionRepository.Update(update); return(_unitOfWork.Commit()); }
public ActionResult Create() { var instroduction = new InstroductionRequest(); return(View("Create", instroduction)); }
public static Instroductions ConvertRequestToModel(this InstroductionRequest instroduction) { return(Mapper.Map <InstroductionRequest, Instroductions>(instroduction)); }