Exemplo n.º 1
0
 public ActionResult EditCaseType(PutCaeTypeViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (_ealertCaseTypesService.IsAlreadyExists(model.UserKey, model.CaseTypeKey, model.Id))
             {
                 ModelState.AddModelError("", "Case Type (" + model.CaseTypeName + ") for this user already exist");
             }
             else
             {
                 var modelDetail = _ealertCaseTypesService.GetDetails(model.Id);
                 modelDetail.ect_user_key      = model.UserKey;
                 modelDetail.ect_case_type_key = model.CaseTypeKey;
                 modelDetail.ect_modified_by   = User.Identity.GetUserId();
                 modelDetail.ect_is_active     = true;
                 modelDetail.ect_modified_date = DateTime.Now.ToEST();
                 _ealertCaseTypesService.Edit(modelDetail);
                 return(Json(new { success = true }));
             }
         }
         return(Json(new { success = false, data = string.Join("<br/>", this.GetModalErrors().Values) }));
     }
     catch (Exception ex)
     {
         Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
         return(Json(new { success = false, data = string.Join("<br/>", this.GetModalErrors().Values) }));
     }
 }
Exemplo n.º 2
0
        public ActionResult EditCaseType(int ect_key)
        {
            var model    = new PutCaeTypeViewModel();
            var response = _ealertCaseTypesService.GetDetails(ect_key);

            if (response != null)
            {
                model.Id           = response.ect_key;
                model.UserFullName = response.AspNetUser.FirstName + " " + response.AspNetUser.LastName;
                model.UserKey      = response.ect_user_key;
                model.CaseTypeKey  = response.ect_case_type_key;
            }
            return(PartialView("_EditCaseType", model));
        }