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()));
 }
Exemple #2
0
        public IActionResult AddDemand([FromBody] DemandViewModelEditAPI demandViewModelEditApi)
        {
            var result = _service.AddDemand(demandViewModelEditApi, out var reason);

            return(Json(new
            {
                result = result,
                reason = reason
            }));
        }
Exemple #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));
 }