public Model.Country Insert(CountryInsertRequest request) { Database.Country entity = _mapper.Map <Database.Country>(request); _context.Country.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Country>(entity)); }
public Model.Country Update(int id, CountryInsertRequest request) { Database.Country entity = _context.Country.Where(x => x.CountryId == id).FirstOrDefault(); _context.Country.Attach(entity); _context.Country.Update(entity); entity = _mapper.Map(request, entity); _context.SaveChanges(); return(_mapper.Map <Model.Country>(entity)); }
public override IAnswer execute() { Database.Country c = new Database.Country(this.Country.Name); AnswerAdd aa = new AnswerAdd(); try{ c.insert(); } catch(Exception e){ aa = new AnswerAdd(e.Message); } return aa; }