public object AddDemand(PostDemand demand)
 {
     if (demand == null || string.IsNullOrEmpty(demand.Author) ||
         string.IsNullOrEmpty(demand.Content))
     {
         return(new ReturnResult <Demand>(-4, "参数传入错误!"));
     }
     return(_DemandService.AddDemand(demand.ToModel()));
 }
Example #2
0
        public IActionResult AddDemand([FromBody] DemandViewModelEditAPI demandViewModelEditApi)
        {
            var result = _service.AddDemand(demandViewModelEditApi, out var reason);

            return(Json(new
            {
                result = result,
                reason = reason
            }));
        }
Example #3
0
        public IActionResult AddDemand(DemandViewModelEdit demandViewModelEdit)
        {
            if (ModelState.IsValid == false)
            {
                return(Json(new
                {
                    result = false,
                    reason = ModelState.GetErrorMessage()
                }));
            }
            var result = _service.AddDemand(demandViewModelEdit, out var reason);

            return(Json(new
            {
                result = result,
                reason = reason
            }));
        }
 public Demand Post([FromBody] Demand demand)
 {
     return(demandService.AddDemand(demand));
 }