Esempio n. 1
0
 public HttpResponseMessage CreateUpdateArea(HttpRequestMessage request, MdAreaViewModel mdAreaVm)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response = null;
         if (!ModelState.IsValid)
         {
             response = request.CreateErrorResponse(HttpStatusCode.BadGateway, ModelState);
             return response;
         }
         MdArea mdArea = new MdArea();
         if (mdAreaVm.ID == null)
         {
             mdArea.UpdateMdArea(mdAreaVm);
             _moduleSearchEngineService.CreateArea(mdArea);
         }
         else
         {
             var mdAreaDb = _moduleSearchEngineService.GetByAreaId(mdAreaVm.ID ?? default(int));
             mdAreaDb.UpdateMdArea(mdAreaVm);
             _moduleSearchEngineService.UpdateArea(mdAreaDb);
         }
         _moduleSearchEngineService.Save();
         response = request.CreateResponse(HttpStatusCode.OK, mdArea);
         return response;
     }));
 }
Esempio n. 2
0
 public MdArea CreateArea(MdArea area)
 {
     return(_mdAreaRepository.Add(area));
 }
Esempio n. 3
0
 public void UpdateArea(MdArea area)
 {
     _mdAreaRepository.Update(area);
 }
Esempio n. 4
0
 public static void UpdateMdArea(this MdArea mdArea, MdAreaViewModel mdAreaVm)
 {
     mdArea.Name  = mdAreaVm.Name;
     mdArea.Alias = Common.HelperMethods.ToUnsignString(mdAreaVm.Name);
     mdArea.BotID = mdAreaVm.BotID;
 }