public void AssociarRegraModulo(Regra regra, Modulo modulo) { regra = _regraRepository.Obter(regra.Id); modulo = _moduloRepository.Obter(modulo.Id); if (regra == null) throw new Exception(Errors.NonexistentRole); if (modulo == null) throw new Exception(Errors.NonexistentModule); regra.Modulos.Add(modulo); this._regraRepository.Atualizar(regra); }
public Task<HttpResponseMessage> Register(Modulo model) { HttpResponseMessage response = new HttpResponseMessage(); try { _service.Registrar(model); response = Request.CreateResponse(HttpStatusCode.OK, model); } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message); } return ApiResponse(response); }
public void Deletar(Modulo modulo) { _context.Modulos.Remove(modulo); _context.SaveChanges(); }
public void Atualizar(Modulo modulo) { _context.Entry<Modulo>(modulo).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); }
public void Criar(Modulo modulo) { _context.Modulos.Add(modulo); _context.SaveChanges(); }