示例#1
0
        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));
            }
        }
示例#2
0
        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));
            }
        }
示例#3
0
        public MstBarangJadiModel Init(MstBarangJadiModel model)
        {
            model.CurrentUser    = CurrentUser;
            model.Menu           = "Barang Jadi";
            model.ChangesHistory = GetChangesHistory((int)Enums.MenuList.GdgBarangJadi, model.ID);

            return(model);
        }
示例#4
0
        public ActionResult Create()
        {
            var model = new MstBarangJadiModel();

            model        = Init(model);
            model.STATUS = true;

            return(View(model));
        }
示例#5
0
        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));
        }