public ActionResult Setup(int?id)
        {
            ComponentTypeSetupViewModel vm = null;

            if (!id.HasValue)
            {
                ViewBag.Title = ComponentStrings.ComponentType_Create_Title;
                vm            = new ComponentTypeSetupViewModel()
                {
                    IsActive = true
                };
            }
            else
            {
                ViewBag.Title = ComponentStrings.ComponentType_Edit_Title;
                vm            = _componentTypeService.GetComponentTypeById(id.Value);
            }

            if (vm == null)
            {
                SystemMessages.Add(CommonStrings.No_Record, true, true);
                return(RedirectToAction("Index"));
            }

            return(PartialView("_Setup", vm));
        }
Esempio n. 2
0
 public IActionResult GetComponentTypeById(int id)
 {
     try {
         var response = _componentTypeService.GetComponentTypeById(id);
         return(Ok(response));
     } catch (Exception e) {
         Util.LogError(e);
         return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorClass()
         {
             code = StatusCodes.Status500InternalServerError.ToString(), message = "Something went wrong"
         }));
     }
 }