Esempio n. 1
0
 public ActionResult Create(TagModel tag)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (service.GetAllTags().All(e => e.Name != tag.Name))
             {
                 service.AddTag(tag.ToServiceTag());
                 if (Request.IsAjaxRequest())
                 {
                     return(PartialView("_TagTableView", Tag.GetTagIndexModel()));
                 }
                 return(RedirectToAction("Index"));
             }
         }
         if (Request.IsAjaxRequest())
         {
             return(PartialView("_TagTableView", Tag.GetTagIndexModel()));
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         logger.Error(ex);
         return(View("Error"));
     }
 }