public ActionResult Create(ViewDeviceType viewdevicetype) { try { if (ModelState.IsValid) { _repository.AddDeviceType(viewdevicetype, GetUserId()); return(RedirectToAction("Index")); } return(View(viewdevicetype)); } catch (Exception e) { ExceptionMessageToViewBag(e); return(View("Error")); } }