public void AtualizarRecursos() { using (var client = InstanciaClient()) { Feed feed = ConverteXML(client, @"http://sharepoint.go2wings.com.br/_api/Web/SiteUsers").Result; foreach (var entry in feed.entry) { var user = entry.content.properties; Recurso rec = recursoRepository.FindByID(user.idUsuario); if (rec == null) { rec = new Recurso(); rec.Nome = user.Title; rec.Email = user.Email; rec.IdRecurso = user.ID; rec.DataCadastro = DateTime.Now; recursoRepository.Add(rec); } } } }
public void Add(Recurso myObject) { try { _repository.Add(myObject); _unitOfWork.Commit(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool Incluir(Entities.Models.Recurso.RecursoModel model) { if (ValidaCamposObrigatorios(model) && ValidaSeRegistroJaCadastrado(model, false)) { var obj = new Recurso(model.Nome); _recursoRepository.Add(obj); return(true); } else { return(false); } }