public IActionResult CreateEquipment(EquipmentEditModel e) { if (ModelState.IsValid) { if (EquipmentRepository.Exist(e.EquipmentName)) { ViewBag.EquipmentExist = "The Equipment Exist"; } else { var k = new Equipment { EquipmentName = e.EquipmentName, EquipmentType = e.EquipmentType, EquipmentDate = DateTime.Parse(e.EquipmentDate) }; EquipmentRepository.Add(k); EquipmentRepository.Commit(); HttpContext.Session.SetString("Equipment", "Successfully created these equipment"); return(RedirectToAction("CreateEquipment")); } } return(View()); }