public ActionResult Put(CACI.DAL.Models.User _obj) { if (ModelState.IsValid) { return(Ok(_service.Update(_obj))); } else { return(BadRequest(ModelState)); } }
public IActionResult Delete([FromBody] CACI.DAL.Models.User _obj) { try { if (ModelState.IsValid) { return(Ok(_service.Delete(_obj))); } else { return(BadRequest(ModelState)); } } catch { return(BadRequest("Failed to delete")); } }
public ActionResult <IEnumerable <CACI.DAL.Models.User> > Login(CACI.DAL.Models.User _obj) { if (ModelState.IsValid) { CACI.DAL.Models.User loggedInUser = _service.Login(_obj); if (loggedInUser == null) { return(Unauthorized()); } else { return(Ok(_service.Login(_obj))); } } else { return(BadRequest(ModelState)); } }
public IActionResult Post(CACI.DAL.Models.User _obj) { try { if (ModelState.IsValid) { return(Ok(_service.Add(_obj))); } else { return(BadRequest(ModelState)); } } catch (Exception ex) { _logger.LogError($"Failed to post User: {ex}", ex); } return(BadRequest("Failed to post User")); }