public bool Delete(Nutriente item, Session session = null) { //LoggerFactory.CreateLog().Start(); var committed = 0; try { //if (session != null) // _repositoryNutriente.UnitOfWork.SetConnectionDb(session.ConnectionString); if (item == null) { throw new ArgumentNullException("item"); } // Domain Services? //_repositoryNutriente.Delete(Mapper.Map<Dominio.Entidades.Nutriente>(item)); _repositoryNutriente.Delete(item); committed = _unitOfWorkAsync.SaveChanges(); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(ex); } //LoggerFactory.CreateLog().Stop(); return(committed > 0); }
public bool Update(Nutriente item, Session session = null) { //LoggerFactory.CreateLog().Start(); var committed = 0; try { //if (session != null) // _repositoryNutriente.UnitOfWork.SetConnectionDb(session.ConnectionString); if (item == null) { throw new ArgumentNullException("item"); } var validator = EntityValidatorFactory.CreateValidator(); if (validator.IsValid(item)) { // Domain Services? //_repositoryNutriente.Update(Mapper.Map<Dominio.Entidades.Nutriente>(item)); _repositoryNutriente.Update(item); committed = _unitOfWorkAsync.SaveChanges(); } else { throw new ApplicationValidationErrorsException(validator.GetInvalidMessages(item)); } } catch (Exception ex) { //LoggerFactory.CreateLog().Error(ex); } //LoggerFactory.CreateLog().Stop(); //_repositoryNutriente.Update(entity); return(committed > 0); }
public NutrienteCrudViewModel() { Nutriente = new Nutriente(); }
public void ApplyChanges(Nutriente entity) { _repositoryNutriente.ApplyChanges(entity); }