Exemple #1
0
        public async Task <DTO.ReturnResponse <DTO.Person> > Update(DTO.Person Person)
        {
            var ret = new DTO.ReturnResponse <DTO.Person>();

            var v = await _db.Person.FirstOrDefaultAsync(o => o.Id == Person.Id);

            v = _mapper.Map <Person>(Person);
            await _db.SaveChangesAsync();

            ret.Result = _mapper.Map <DTO.Person>(v);

            return(ret);
        }
Exemple #2
0
        public async Task <DTO.ReturnResponse <DTO.Person> > Add(DTO.Person Person)
        {
            var ret = new DTO.ReturnResponse <DTO.Person>();

            var val = _mapper.Map <Person>(Person);

            OrmHelper.SetAuditColumns <Person>(ref val, true, 1);
            _db.Person.Add(val);
            await _db.SaveChangesAsync();

            ret.Result = _mapper.Map <DTO.Person>(val);
            return(ret);
        }