public ActionResult <IEnumerable <LogDTO> > Post([FromBody] LogAddDTO log) { try { if (!ModelState.IsValid) { throw new Exception("Fail on model validation"); } _app.Add(log); return(_app.SelectAll()); } catch (Exception ex) { _err.Add(ex, HttpContext.User.Identity.Name); return(BadRequest(ex.Message)); } }
public void Add(LogAddDTO entity) { _repo.Add(_mapper.Map <Log>(entity)); }