public IActionResult Deactivation(SystemDeleteRequestModel model) { try { var result = _service.RemoveSystem(model); if (result == null) { return(BadRequest("Something is wrong !! you can check it again, please !!")); } return(Ok(result)); } catch (Exception e) { try { _logService.SendLogError(e); } catch (System.Exception ex) { return(StatusCode(503, ex.Message)); } return(StatusCode(503, e)); } }
public SystemsServiceModel RemoveSystem(SystemDeleteRequestModel model) { try { var system = _repo.GetActive().Where(p => p.Id == model.Id).FirstOrDefault(); if (system == null) { return(null); } else { system.Active = false; _repo.Update(system); _repo.SaveChanges(); } return(Mapper.Map <Systems, SystemsServiceModel>(system)); } catch (Exception) { throw; } }