/// <summary> /// 新增公司信息 /// </summary> /// <returns></returns> public ActionResult Add() { string CompanyNum = WebUtil.GetFormValue <string>("CompanyNum"); string CompanyName = WebUtil.GetFormValue <string>("CopanyName"); string CreateUser = WebUtil.GetFormValue <string>("CreateUser"); CompanyEntity entity = new CompanyEntity(); entity.CompanyNum = CompanyNum; entity.CompanyName = CompanyName; entity.CreateUser = CreateUser; CompanyProvider provider = new CompanyProvider(); int line = provider.Add(entity); DataResult dataResult = new DataResult(); if (line > 0) { dataResult.Code = (int)EResponseCode.Success; dataResult.Message = "新增成功"; } else { dataResult.Code = (int)EResponseCode.Success; dataResult.Message = "新增失败"; } return(Content(JsonHelper.SerializeObject(dataResult))); }
//[ProducesResponseType(typeof(long), StatusCodes.Status200OK)] //[ProducesResponseType(StatusCodes.Status400BadRequest)] //[ProducesDefaultResponseType] public IActionResult Post([FromBody] Company value) { long res = CompanyProvider.Add(value); if (res == 0) { return(BadRequest()); } else { return(Ok(res)); } }