Beispiel #1
0
 public static void UpdatePriceHistory(this PriceHistory priceHistory, PriceHistoryViewModel priceHistoryVM)
 {
     priceHistory.ProductID  = priceHistoryVM.ProductID;
     priceHistory.UpdateBy   = priceHistoryVM.UpdateBy;
     priceHistory.UpdateDate = priceHistoryVM.UpdateDate;
     priceHistory.Price      = priceHistoryVM.Price;
     priceHistory.Promotion  = priceHistoryVM.Promotion;
 }
 public HttpResponseMessage Post(HttpRequestMessage request, PriceHistoryViewModel priceHistoryVm)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response = null;
         if (!ModelState.IsValid)
         {
             request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
         }
         else
         {
             PriceHistory newPriceHistory = new PriceHistory();
             newPriceHistory.UpdatePriceHistory(priceHistoryVm);
             var category = _priceHistoryService.Add(newPriceHistory);
             _priceHistoryService.SaveChanges();
             response = request.CreateResponse(HttpStatusCode.Created, category);
         }
         return response;
     }));
 }