Esempio n. 1
0
 public HttpResponseMessage Update(HttpRequestMessage request, ParentProductCategoryViewModel parentProductCategoryViewModel)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response = null;
         if (!ModelState.IsValid)
         {
             response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
         }
         else
         {
             ParentProductCategory parentProductCategory = new ParentProductCategory();
             parentProductCategory.UpdateParentProductCategory(parentProductCategoryViewModel);
             _parentProductCategoryService.Update(parentProductCategory);
             _parentProductCategoryService.SaveChange();
             var mapper = Mapper.Map <ParentProductCategory, ParentProductCategoryViewModel>(parentProductCategory);
             response = request.CreateResponse(HttpStatusCode.Created, mapper);
         }
         return response;
     }));
 }
Esempio n. 2
0
 public void Update(ParentProductCategory parentProductCategory)
 {
     _parentProductCategory.Update(parentProductCategory);
 }
Esempio n. 3
0
 public ParentProductCategory Create(ParentProductCategory parentProductCategory)
 {
     return(_parentProductCategory.Add(parentProductCategory));
 }
Esempio n. 4
0
 public static void UpdateParentProductCategory(this ParentProductCategory parentProductCategory, ParentProductCategoryViewModel parentProductCategoryVM)
 {
     parentProductCategory.ID   = parentProductCategoryVM.ID;
     parentProductCategory.Name = parentProductCategoryVM.Name;
 }