示例#1
0
        public IHttpActionResult PostQuote(Quote quote)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var userid = userID();

            quote.UserId = Convert.ToInt32(userid);
            if (quote.DueDate == null)
            {
                quote.DueDate = DateTime.Now;
            }
            quoteServices.Insert(quote);
            quoteServices.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = quote.QuoteId }, quote));
        }