public void Update(int cowId, CreateCowDto updateCow) { var cow = _context.Cows.FirstOrDefault(cow => cow.Id == cowId); cow = _mapper.Map(updateCow, cow); _context.Update(cow); _context.SaveChanges(); }
public void Add(CreateCowDto createCow) { var cow = _mapper.Map <Cow>(createCow); _context.Cows.Add(cow); _context.SaveChanges(); }