Example #1
0
 public ActionResult Add(GoodsUnitModel model)
 {
     if (ModelState.IsValid)
     {
         GoodsUnit goodsUnit = model.MapTo <GoodsUnitModel, GoodsUnit>();
         _goodsUnitService.Insert(goodsUnit);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Example #2
0
 public ActionResult Edit(GoodsUnitModel model)
 {
     if (ModelState.IsValid)
     {
         GoodsUnit goodsUnit = model.MapTo <GoodsUnitModel, GoodsUnit>();
         _goodsUnitService.Update(goodsUnit);
         SuccessNotification($"{_localizationService.GetResource("UpdateSuccess") }");
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Example #3
0
        public void Update(GoodsUnit GoodsUnit)
        {
            var sql = $@"update GoodsUnit set
                    Name=@Name
                    where ID=@ID";

            _context.Execute(sql, new
            {
                ID   = GoodsUnit.ID,
                Name = GoodsUnit.Name
            });
        }
Example #4
0
        public void Insert(GoodsUnit GoodsUnit)
        {
            var sql = $@"insert into GoodsUnit(
                    Name)
			        VALUES (
                    @Name)";

            _context.Execute(sql, new
            {
                Name = GoodsUnit.Name
            });
        }
Example #5
0
        public JsonResult Edit(GoodsUnit model)
        {
            var apiResult = new APIResult();

            try
            {
                GoodsUnitBll.AddOrUpdate(model, UserContext.CurrentUser.HotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }