Exemplo n.º 1
0
        public IActionResult DeleteRelatedMaintenance(RelatedMaintenanceViewModel related)
        {
            var parent = _service.GetRelatedMaintenanceById(related.Id).FaultId;

            _service.DeleteRelatedMaintenance(related.Id);

            return(RedirectToAction("ListRelatedMaintenance", new { parentId = parent }));
        }
Exemplo n.º 2
0
        public IActionResult CreateRelatedMaintenance(RelatedMaintenanceViewModel related)
        {
            if (!ModelState.IsValid)
            {
                return(View(related));
            }

            _service.CreateRelatedMaintenance(related);

            return(RedirectToAction("ListRelatedMaintenance", new { parentId = related.FaultId }));
        }
Exemplo n.º 3
0
        public IActionResult EditRelatedMaintenance(RelatedMaintenanceViewModel related)
        {
            if (!ModelState.IsValid)
            {
                return(View(related));
            }
            if ((!related.isFull() && !related.isEmpty()) || !related.isValidTI())
            {
                ModelState.AddModelError("Incomplete", "Incomplete Form");
                return(View(related));
            }

            _service.UpdateRelatedMaintenance(related);

            return(RedirectToAction("ListRelatedMaintenance", new { parentId = related.FaultId }));
        }