Example #1
0
        public JsonResult EditCommodityType(FormCollection form)
        {
            var apiResult = new APIResult();

            try
            {
                var           opt   = form["opt"];
                CommodityType model = new CommodityType();
                model.Name = form["name"];
                if (opt == "0")
                {
                    model.Pid = Convert.ToInt64(form["id"]);
                }
                else
                {
                    model.Id = Convert.ToInt64(form["id"]);
                }

                CommodityTypeBll.AddOrUpdate(model, UserContext.CurrentUser.Name, 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));
        }