예제 #1
0
        public IHttpActionResult Create(Offer offer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var offerr = _service.Create(offer);

            return(Ok(offerr));
        }
예제 #2
0
        public ResponseItem Post(Offer _offer)
        {
            User user = HttpContext.Items["user"] as User;

            _offer.FromUser = user.Id;

            string createStatus = _offerService.Create(_offer);

            if (createStatus.StartsWith("id: ") == false)
            {
                return(new ResponseItem("error", createStatus));
            }
            else
            {
                return(new ResponseItem("success", createStatus.Substring("id: ".Length)));
            }
        }
 public ActionResult <Offer> Create([FromBody] Offer offer)
 {
     return(_offerService.Create(offer));
 }