public HttpResponseMessage updateArticlePrice(String id, Models.MstArticlePrice price) { try { var prices = from d in db.MstArticlePrices where d.Id == Convert.ToInt32(id) select d; if (prices.Any()) { var updatePrice = prices.FirstOrDefault(); updatePrice.ArticleId = price.ArticleId; updatePrice.PriceDescription = price.PriceDescription; updatePrice.Price = price.Price; updatePrice.Remarks = price.Remarks; db.SubmitChanges(); return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } } catch { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
public Int32 insertArticlePrice(Models.MstArticlePrice price) { try { Data.MstArticlePrice newPrice = new Data.MstArticlePrice(); newPrice.ArticleId = price.ArticleId; newPrice.PriceDescription = price.PriceDescription; newPrice.Price = price.Price; newPrice.Remarks = price.Remarks; db.MstArticlePrices.InsertOnSubmit(newPrice); db.SubmitChanges(); return(newPrice.Id); } catch { return(0); } }