public ActionResult Detail(string id) { var intId = 0; int.TryParse(id, out intId); try { DTOMedicine dtomedicine = medicineRepository.GetDTOMedicineById(intId); if (dtomedicine == null) { return(RedirectToAction("Error404", "Error")); } medicineModel = new MedicineModels { dtomedicine = dtomedicine, }; } catch (Exception ex) { log.Error(ex); ModelState.AddModelError("error", Translator.UnexpectedError); } return(View(medicineModel)); }