Beispiel #1
0
 public static void UpdateSituationCategory(this SituationCategory situationCategory, SituationCategoryViewModel situationCategoryVm)
 {
     situationCategory.ID              = situationCategoryVm.ID;
     situationCategory.Name            = situationCategoryVm.Name;
     situationCategory.Alias           = situationCategoryVm.Alias;
     situationCategory.Description     = situationCategoryVm.Description;
     situationCategory.ParentID        = situationCategoryVm.ParentID;
     situationCategory.HomeFlag        = situationCategoryVm.HomeFlag;
     situationCategory.DisplayOrder    = situationCategoryVm.DisplayOrder;
     situationCategory.CreatedDate     = situationCategoryVm.CreatedDate;
     situationCategory.CreatedBy       = situationCategoryVm.CreatedBy;
     situationCategory.UpdatedBy       = situationCategoryVm.UpdatedBy;
     situationCategory.UpdatedDate     = situationCategoryVm.UpdatedDate;
     situationCategory.MetaKeyword     = situationCategoryVm.MetaKeyword;
     situationCategory.MetaDescription = situationCategoryVm.MetaDescription;
     situationCategory.Status          = situationCategoryVm.Status;
 }
        public HttpResponseMessage Create(HttpRequestMessage request, SituationCategoryViewModel situationCategoryVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage respone = null;
                if (!ModelState.IsValid)
                {
                    respone = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var newSituationCategory = new SituationCategory();
                    newSituationCategory.UpdateSituationCategory(situationCategoryVm);
                    newSituationCategory.CreatedDate = DateTime.Now;
                    _situationCategoryService.Add(newSituationCategory);
                    _situationCategoryService.Save();

                    var responeData = Mapper.Map <SituationCategory, SituationCategoryViewModel>(newSituationCategory);
                    respone = request.CreateResponse(HttpStatusCode.OK, responeData);
                }
                return respone;
            }));
        }
Beispiel #3
0
 public void Update(SituationCategory situationCategory)
 {
     _situationCategoryRepository.Update(situationCategory);
 }
Beispiel #4
0
 public void Add(SituationCategory situationCategory)
 {
     _situationCategoryRepository.Add(situationCategory);
 }