public HttpResponseMessage UpdateShopping(int ID, string Name, string Date) { try { DateTime DateCreate = DateTime.Now; try { DateCreate = DateTime.ParseExact(Date, "yyyy-MM-dd", CultureInfo.InvariantCulture); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message)); } Shopping Bll = new Shopping(); MShopping Model = new MShopping() { Id = ID, Name = Name, CreatedDate = DateCreate, }; var Data = Bll.InsertData(Model); return(Request.CreateResponse(HttpStatusCode.OK, Data)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }