コード例 #1
0
 [HttpPost] // POST
 public ActionResult <DbCombo> Create([FromBody] DbCombo newCombo)
 {
     try
     {
         return(Ok(_comboService.Create(newCombo)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #2
0
        public ActionResult ComboSave()
        {
            ComboInfo info      = SerializationUtility.JsonDeserialize <ComboInfo>(Request.Form["data"]);
            var       loginUser = UserAuthHelper.GetCurrentUser();

            info.SellerSysNo   = loginUser.SellerSysNo;
            info.InUserSysNo   = loginUser.UserSysNo;
            info.InUserName    = loginUser.UserDisplayName;
            info.EditUserSysNo = loginUser.UserSysNo;
            info.EditUserName  = loginUser.UserDisplayName;
            if (info.SysNo > 0)
            {
                _comboService.Update(info);
                return(JsonSuccess(info.SysNo, LanguageHelper.GetText("更新成功。")));
            }
            else
            {
                _comboService.Create(info);
                return(JsonSuccess(info.SysNo, LanguageHelper.GetText("创建成功。")));
            }
        }