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)); } }
public List <MShopping> InsertData(MShopping Model) { try { return(dbtran.DbToList <MShopping>("SP_Add_Shopping", new { Name = Model.Name, CreatedDate = Model.CreatedDate }, true)); } catch (Exception ex) { throw ex; } }
public List <MShopping> UpdateShopping(MShopping Model) { try { return(dbtran.DbToList <MShopping>("SP_UPDATE_Shopping", new { ID = Model.Id, Name = Model.Name, CreatedDate = Model.CreatedDate, }, true)); } catch (Exception ex) { throw ex; } }