public ActionResult <Api <IndentificationDTO> > New(IndentificationEntity newEntity) { IndentificationDTO dto = _indentificationService.Save(newEntity); Api <IndentificationDTO> result = new Api <IndentificationDTO>(200, dto, "Add Success"); return(Ok(result)); }
public IndentificationDTO Save(IndentificationEntity newEntity) { var transaction = _humanManagerContext.Database.BeginTransaction(); IndentificationEntity entity = null; try { entity = _humanManagerContext.Indentifications.Add(newEntity).Entity; _humanManagerContext.SaveChanges(); transaction.Commit(); IndentificationDTO dto = _mapper.Map <IndentificationDTO>(entity); return(dto); } catch { transaction.Rollback(); return(null); } }