public int CreateCat(CreateCatDto dto) { var c = new Cat(dto.Name); using (var uow = _uowFactory.Create()) { _catRepository.Inject(uow); _catRepository.Save(c); uow.Flush(); } return(c.Id); }
/// <summary> /// Save a cat /// </summary> /// <param name="cat">The Cat</param> /// <returns>The Cat</returns> public Cat Save(Cat cat) { try { _catRepository.Save(cat); return(cat); } catch (Exception ex) { _logger.LogError(ex.Message); throw; } }