public ActionResult CreateTest(Test model) { int result = 0; string domainName = _configuration["DomainName"].ToSafeString(); if (!string.IsNullOrEmpty(domainName)) { result = BALUser.AddTest(model, domainName); } switch (result) { case -1: TempData["message"] = "Test Name already exists for same date."; TempData["IsSuccess"] = 0; break; case 0: TempData["message"] = "Something went wrong."; TempData["IsSuccess"] = 0; break; case 1: TempData["message"] = "Record successfully inserted."; TempData["IsSuccess"] = 1; break; case 2: TempData["message"] = "Record successfully updated."; TempData["IsSuccess"] = 1; break; } return(RedirectToAction("Index")); }