public ActionResult Create(MstBarangJadiModel model) { if (ModelState.IsValid) { try { var Dto = Mapper.Map <MstBarangJadiDto>(model); Dto.CREATED_BY = CurrentUser.USERNAME; Dto.CREATED_DATE = DateTime.Now; Dto.STATUS = true; _mstBarangJadiBLL.Save(Dto, Mapper.Map <LoginDto>(CurrentUser)); return(RedirectToAction("Index", "MstBarangJadi")); } catch (Exception) { throw; } } else { model = Init(model); return(View(model)); } }
public ActionResult Edit(MstBarangJadiModel model) { if (ModelState.IsValid) { try { var GetData = _mstBarangJadiBLL.GetById(model.ID); GetData.STATUS = model.STATUS; GetData.MODIFIED_BY = CurrentUser.USERNAME; GetData.MODIFIED_DATE = DateTime.Now; _mstBarangJadiBLL.Save(GetData, Mapper.Map <LoginDto>(CurrentUser)); return(RedirectToAction("Index", "MstBarangJadi")); } catch (Exception) { throw; } } else { model = Init(model); return(View(model)); } }
public MstBarangJadiModel Init(MstBarangJadiModel model) { model.CurrentUser = CurrentUser; model.Menu = "Barang Jadi"; model.ChangesHistory = GetChangesHistory((int)Enums.MenuList.GdgBarangJadi, model.ID); return(model); }
public ActionResult Create() { var model = new MstBarangJadiModel(); model = Init(model); model.STATUS = true; return(View(model)); }
public ActionResult Edit(int?id) { if (!id.HasValue) { return(HttpNotFound()); } var model = new MstBarangJadiModel(); var GetData = _mstBarangJadiBLL.GetById(id); if (GetData == null) { return(HttpNotFound()); } model = Mapper.Map <MstBarangJadiModel>(GetData); model = Init(model); return(View(model)); }