Exemple #1
0
 public ActionResult Edit([Bind(Include = "TerceirizadoId,Nome,Cpf,DataAdmissao,Telefone,TipoLotacao,Lotacao,PrestadoraServicoId,CargoId,OcorrenciaId")] Terceirizado terceirizado)
 {
     if (ModelState.IsValid)
     {
         db.Entry(terceirizado).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CargoId             = new SelectList(db.Cargoes, "CargoId", "Nome", terceirizado.CargoId);
     ViewBag.OcorrenciaId        = new SelectList(db.Ocorrencias, "OcorrenciaId", "Descricao", terceirizado.OcorrenciaId);
     ViewBag.PrestadoraServicoId = new SelectList(db.PrestadoraServicoes, "PrestadoraServicoId", "RazaoSocial", terceirizado.PrestadoraServicoId);
     return(View(terceirizado));
 }
Exemple #2
0
        public async Task <IActionResult> PutUsers([FromRoute] int id, [FromBody] Users users)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(new
                    {
                        status = false,
                        message = HttpStatusCode.BadRequest.ToString()
                    }));
                }

                if (id != users.UserId)
                {
                    return(BadRequest(new
                    {
                        status = false,
                        message = HttpStatusCode.BadRequest.ToString()
                    }));
                }

                _context.Entry(users).State = EntityState.Modified;

                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(id))
                    {
                        return(NotFound(new
                        {
                            status = false,
                            message = HttpStatusCode.NotFound.ToString()
                        }));
                    }
                    else
                    {
                        throw;
                    }
                }

                return(Ok(new
                {
                    status = true,
                    data = users
                }));
            }
            catch
            {
                return(BadRequest(new
                {
                    status = false,
                    message = HttpStatusCode.BadRequest.ToString()
                }));
            }
        }
Exemple #3
0
        public bool DeleteAccommodationType(AccommodationType accommodationType)
        {
            var context = new PMSContext();

            context.Entry(accommodationType).State = System.Data.Entity.EntityState.Deleted;

            return(context.SaveChanges() > 0);
        }
        public bool UpdateAccommodation(Accommodation accommodation)
        {
            var context = new PMSContext();

            context.Entry(accommodation).State = System.Data.Entity.EntityState.Modified;

            return(context.SaveChanges() > 0);
        }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "QualificationId,QualificationName")] Qualification qualification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(qualification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(qualification));
 }
Exemple #6
0
 public ActionResult Edit([Bind(Include = "OcorrenciaId,Numero,Descricao")] Ocorrencia ocorrencia)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ocorrencia).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ocorrencia));
 }
Exemple #7
0
 public ActionResult Edit([Bind(Include = "PrefeituraBairroId,Codigo,Nome,Endereco,Referencia,Cep,Email,Tel1,Tel2,Gestor")] PrefeituraBairro prefeituraBairro)
 {
     if (ModelState.IsValid)
     {
         db.Entry(prefeituraBairro).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(prefeituraBairro));
 }
 public ActionResult Edit([Bind(Include = "EmployeeTypeId,EmployeeTypeName")] EmployeeType employeetype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeetype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employeetype));
 }
Exemple #9
0
 public ActionResult Edit([Bind(Include = "TrainingTypeId,TrainingTypeName")] TrainingType trainingtype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trainingtype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(trainingtype));
 }
Exemple #10
0
 public ActionResult Edit([Bind(Include = "TipoCargoId,Nome")] TipoCargo tipoCargo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tipoCargo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tipoCargo));
 }
Exemple #11
0
 public ActionResult Edit([Bind(Include = "PrestadoraServicoId,RazaoSocial,Cnpj,Telefone,Email")] PrestadoraServico prestadoraServico)
 {
     if (ModelState.IsValid)
     {
         db.Entry(prestadoraServico).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(prestadoraServico));
 }
Exemple #12
0
 public ActionResult Edit([Bind(Include = "ID,Descricao,Preco,UltimaCompra,Estoque")] Produto produto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(produto).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(produto));
 }
Exemple #13
0
 public ActionResult Edit([Bind(Include = "TipoOcorrenciaPBId,Tipo,Observacao")] TipoOcorrenciaPB tipoOcorrenciaPB)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tipoOcorrenciaPB).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tipoOcorrenciaPB));
 }
Exemple #14
0
 public ActionResult Edit([Bind(Include = "StatusOcorrenciaSecId,Status,Observacao")] StatusOcorrenciaSec statusOcorrenciaSec)
 {
     if (ModelState.IsValid)
     {
         db.Entry(statusOcorrenciaSec).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(statusOcorrenciaSec));
 }
Exemple #15
0
 public ActionResult Edit([Bind(Include = "DescricaoOcorrenciaEscolaId,Descricao,Observacao")] DescricaoOcorrenciaEscola descricaoOcorrenciaEscola)
 {
     if (ModelState.IsValid)
     {
         db.Entry(descricaoOcorrenciaEscola).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(descricaoOcorrenciaEscola));
 }
Exemple #16
0
 public ActionResult Edit([Bind(Include = "CrimeId,CrimeName")] Crime crime)
 {
     if (ModelState.IsValid)
     {
         db.Entry(crime).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(crime));
 }
Exemple #17
0
 public ActionResult Edit([Bind(Include = "SecretariaId,Nome,Setor,Observacao")] Secretaria secretaria)
 {
     if (ModelState.IsValid)
     {
         db.Entry(secretaria).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(secretaria));
 }
Exemple #18
0
 public ActionResult Edit([Bind(Include = "EscolaId,Codigo,Nome,Tel1,Tel2,Cep,Bairro,Logradouro,Numero,Latitude,Longitude,Gestor,GreId")] Escola escola)
 {
     if (ModelState.IsValid)
     {
         db.Entry(escola).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GreId = new SelectList(db.Gres, "GreId", "Regional", escola.GreId);
     return(View(escola));
 }
Exemple #19
0
 public ActionResult Edit([Bind(Include = "GreId,Regional,Codigo,Endereco,Referencia,Cep,Email,Tel1,Tel2,Gestor,SecretariaId")] Gre gre)
 {
     if (ModelState.IsValid)
     {
         db.Entry(gre).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SecretariaId = new SelectList(db.Secretarias, "SecretariaId", "Nome", gre.SecretariaId);
     return(View(gre));
 }
Exemple #20
0
 public ActionResult Edit([Bind(Include = "CargoId,Nome,Descricao,TipoCargoId")] Cargo cargo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cargo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TipoCargoId = new SelectList(db.TipoCargoes, "TipoCargoId", "Nome", cargo.TipoCargoId);
     return(View(cargo));
 }
Exemple #21
0
 public ActionResult Edit([Bind(Include = "HistoricoStatusOcorrenciaSecId,Data,Observacao,StatusOcorrenciaSecId,OcorrenciaSecId")] HistoricoStatusOcorrenciaSec historicoStatusOcorrenciaSec)
 {
     if (ModelState.IsValid)
     {
         db.Entry(historicoStatusOcorrenciaSec).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OcorrenciaSecId       = new SelectList(db.OcorrenciaSecs, "OcorrenciaSecId", "latitude", historicoStatusOcorrenciaSec.OcorrenciaSecId);
     ViewBag.StatusOcorrenciaSecId = new SelectList(db.StatusOcorrenciaSecs, "StatusOcorrenciaSecId", "Status", historicoStatusOcorrenciaSec.StatusOcorrenciaSecId);
     return(View(historicoStatusOcorrenciaSec));
 }
Exemple #22
0
 public ActionResult Edit([Bind(Include = "EmployeeId,FirstName,LastName,Gender,BirthDate,AppointmentDate,QualificationId,EmployeeTypeId,UserName,Password,PhoneNo")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmployeeTypeId  = new SelectList(db.EmployeeTypes, "EmployeeTypeId", "EmployeeTypeName", employee.EmployeeTypeId);
     ViewBag.QualificationId = new SelectList(db.Qualifications, "QualificationId", "QualificationName", employee.QualificationId);
     return(View(employee));
 }
Exemple #23
0
 public ActionResult Edit([Bind(Include = "CaseId,CaseName,CaseDate,PrisonerId,JudgeName,CourtName,CaseDescription,Scheduled,EmployeeId")] Case @case)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@case).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "FirstName", @case.EmployeeId);
     ViewBag.PrisonerId = new SelectList(db.Prisoners, "PrisonerId", "FirstName", @case.PrisonerId);
     return(View(@case));
 }
Exemple #24
0
        public bool DeleteAccommodationPackage(AccommodationPackage accommodationPackage)
        {
            var context = new PMSContext();


            var existingAccommodationPackage = context.AccommodationPackages.Find(accommodationPackage.ID);

            context.AccommodationPackagePictures.RemoveRange(existingAccommodationPackage.AccommodationPackagePicture);
            context.Entry(existingAccommodationPackage).State = System.Data.Entity.EntityState.Deleted;

            return(context.SaveChanges() > 0);
        }
Exemple #25
0
 public ActionResult Edit([Bind(Include = "OcorrenciaPBId,latitude,longitude,logradouro,numero,bairro,cep,cidade,estado,Data,TipoOcorrenciaPBId,DescricaoOcorrenciaPBId,PrefeituraBairroId")] OcorrenciaPB ocorrenciaPB)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ocorrenciaPB).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DescricaoOcorrenciaPBId = new SelectList(db.DescricaoOcorrenciaPBs, "DescricaoOcorrenciaPBId", "Descricao", ocorrenciaPB.DescricaoOcorrenciaPBId);
     ViewBag.PrefeituraBairroId      = new SelectList(db.PrefeituraBairroes, "PrefeituraBairroId", "Nome", ocorrenciaPB.PrefeituraBairroId);
     ViewBag.TipoOcorrenciaPBId      = new SelectList(db.TipoOcorrenciaPBs, "TipoOcorrenciaPBId", "Tipo", ocorrenciaPB.TipoOcorrenciaPBId);
     return(View(ocorrenciaPB));
 }
Exemple #26
0
 public ActionResult Edit([Bind(Include = "OcorrenciaSecId,latitude,longitude,logradouro,numero,bairro,cep,cidade,estado,Data,TipoOcorrenciaSecId,DescricaoOcorrenciaSecId,SecretariaId")] OcorrenciaSec ocorrenciaSec)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ocorrenciaSec).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DescricaoOcorrenciaSecId = new SelectList(db.DescricaoOcorrenciaSecs, "DescricaoOcorrenciaSecId", "Descricao", ocorrenciaSec.DescricaoOcorrenciaSecId);
     ViewBag.SecretariaId             = new SelectList(db.Secretarias, "SecretariaId", "Nome", ocorrenciaSec.SecretariaId);
     ViewBag.TipoOcorrenciaSecId      = new SelectList(db.TipoOcorrenciaSecs, "TipoOcorrenciaSecId", "Tipo", ocorrenciaSec.TipoOcorrenciaSecId);
     return(View(ocorrenciaSec));
 }
Exemple #27
0
 public ActionResult Edit([Bind(Include = "OcorrenciaGreId,latitude,longitude,logradouro,numero,bairro,cep,cidade,estado,Data,TipoOcorrenciaGreId,DescricaoOcorrenciaGreId,GreId")] OcorrenciaGre ocorrenciaGre)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ocorrenciaGre).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DescricaoOcorrenciaGreId = new SelectList(db.DescricaoOcorrenciaGres, "DescricaoOcorrenciaGreId", "Descricao", ocorrenciaGre.DescricaoOcorrenciaGreId);
     ViewBag.GreId = new SelectList(db.Gres, "GreId", "Regional", ocorrenciaGre.GreId);
     ViewBag.TipoOcorrenciaGreId = new SelectList(db.TipoOcorrenciaGres, "TipoOcorrenciaGreId", "Tipo", ocorrenciaGre.TipoOcorrenciaGreId);
     return(View(ocorrenciaGre));
 }
Exemple #28
0
 public ActionResult Edit([Bind(Include = "TrainingId,TrainingTypeId,Duration,Trained,PrisonerId,EmployeeId")] Training training)
 {
     if (ModelState.IsValid)
     {
         db.Entry(training).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmployeeId     = new SelectList(db.Employees, "EmployeeId", "FirstName", training.EmployeeId);
     ViewBag.PrisonerId     = new SelectList(db.Prisoners, "PrisonerId", "FirstName", training.PrisonerId);
     ViewBag.TrainingTypeId = new SelectList(db.TrainingTypes, "TrainingTypeId", "TrainingTypeName", training.TrainingTypeId);
     return(View(training));
 }
Exemple #29
0
        public bool UpdateAccommodationPackage(AccommodationPackage accommodationPackage)
        {
            var context = new PMSContext();

            var existingAccommodationPackage = context.AccommodationPackages.Find(accommodationPackage.ID);

            context.AccommodationPackagePictures.RemoveRange(existingAccommodationPackage.AccommodationPackagePicture);

            context.Entry(existingAccommodationPackage).CurrentValues.SetValues(accommodationPackage);

            context.AccommodationPackagePictures.AddRange(accommodationPackage.AccommodationPackagePicture);

            return(context.SaveChanges() > 0);
        }
        public async Task <IActionResult> Update([FromBody] OrderUpdateRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var existingOrder = await _context.Order.SingleOrDefaultAsync(x => x.OrderId == model.OrderId);

            if (existingOrder == null)
            {
                return(NotFound());
            }

            var order = _mapper.Map <Order>(model);

            _context.Entry(existingOrder).CurrentValues.SetValues(order);
            await _context.SaveChangesAsync();

            return(NoContent());
        }