示例#1
0
        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));
            }
        }
示例#2
0
 public void Add(LogAddDTO entity)
 {
     _repo.Add(_mapper.Map <Log>(entity));
 }