private void AddClient() { ManagerValidation VM = new ManagerValidation(); bool correctForm = VM.ClientValidation(FirstName, LastName, CompanyName, NIP, REGON); if (correctForm) { Client client; client = AddClientObject(); dbContext.Client.Add(client); dbContext.SaveChanges(); _FilteredClients = new ObservableCollection <Client>(dbContext.Client); _Clients = new ObservableCollection <Client>(dbContext.Client); RaisePropertyChanged("FilteredClients"); RaisePropertyChanged("Clients"); clear(); ErrorMessage er = new ErrorMessage("Client created successfully!"); er.ShowDialog(); } }
private void AddArticle() { AdminValidation VM = new AdminValidation(); bool correctForm = VM.WikiValidation(Url, Description); if (correctForm) { Article article = new Article() { Url = _Url, Description = _Description, DateAdded = DateTime.Now, UserID = Global.user.UserID }; dbContext.Article.Add(article); dbContext.SaveChanges(); Articles = new ObservableCollection <Article>(dbContext.Article); setVariableWhenAddArticle(); ErrorMessage er = new ErrorMessage("Add article!"); er.ShowDialog(); } }
public ActionResult Create([Bind(Include = "PrestadoraServicoId,RazaoSocial,Cnpj,Telefone,Email")] PrestadoraServico prestadoraServico) { if (ModelState.IsValid) { db.PrestadoraServicoes.Add(prestadoraServico); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(prestadoraServico)); }
public ActionResult Create([Bind(Include = "ID,Descricao,Preco,UltimaCompra,Estoque")] Produto produto) { if (ModelState.IsValid) { db.Produtoes.Add(produto); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(produto)); }
public ActionResult Create([Bind(Include = "QualificationId,QualificationName")] Qualification qualification) { if (ModelState.IsValid) { db.Qualifications.Add(qualification); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(qualification)); }
public ActionResult Create([Bind(Include = "TipoOcorrenciaPBId,Tipo,Observacao")] TipoOcorrenciaPB tipoOcorrenciaPB) { if (ModelState.IsValid) { db.TipoOcorrenciaPBs.Add(tipoOcorrenciaPB); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tipoOcorrenciaPB)); }
public ActionResult Create([Bind(Include = "StatusOcorrenciaSecId,Status,Observacao")] StatusOcorrenciaSec statusOcorrenciaSec) { if (ModelState.IsValid) { db.StatusOcorrenciaSecs.Add(statusOcorrenciaSec); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(statusOcorrenciaSec)); }
public ActionResult Create([Bind(Include = "SecretariaId,Nome,Setor,Observacao")] Secretaria secretaria) { if (ModelState.IsValid) { db.Secretarias.Add(secretaria); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(secretaria)); }
public ActionResult Create([Bind(Include = "PrefeituraBairroId,Codigo,Nome,Endereco,Referencia,Cep,Email,Tel1,Tel2,Gestor")] PrefeituraBairro prefeituraBairro) { if (ModelState.IsValid) { db.PrefeituraBairroes.Add(prefeituraBairro); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(prefeituraBairro)); }
public ActionResult Create([Bind(Include = "OcorrenciaId,Numero,Descricao")] Ocorrencia ocorrencia) { if (ModelState.IsValid) { db.Ocorrencias.Add(ocorrencia); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ocorrencia)); }
public ActionResult Create([Bind(Include = "EmployeeTypeId,EmployeeTypeName")] EmployeeType employeetype) { if (ModelState.IsValid) { db.EmployeeTypes.Add(employeetype); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employeetype)); }
public ActionResult Create([Bind(Include = "CrimeId,CrimeName")] Crime crime) { if (ModelState.IsValid) { db.Crime.Add(crime); db.SaveChanges(); return(RedirectToAction("Index", "Role")); } return(View(crime)); }
public ActionResult Create([Bind(Include = "TrainingTypeId,TrainingTypeName")] TrainingType trainingtype) { if (ModelState.IsValid) { db.TrainingTypes.Add(trainingtype); db.SaveChanges(); return(RedirectToAction("Index", "Role")); } return(View(trainingtype)); }
public ActionResult Create([Bind(Include = "TipoCargoId,Nome")] TipoCargo tipoCargo) { if (ModelState.IsValid) { db.TipoCargoes.Add(tipoCargo); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tipoCargo)); }
public ActionResult Create([Bind(Include = "DescricaoOcorrenciaEscolaId,Descricao,Observacao")] DescricaoOcorrenciaEscola descricaoOcorrenciaEscola) { if (ModelState.IsValid) { db.DescricaoOcorrenciaEscolas.Add(descricaoOcorrenciaEscola); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(descricaoOcorrenciaEscola)); }
public ActionResult Create([Bind(Include = "EscolaId,Codigo,Nome,Tel1,Tel2,Cep,Bairro,Logradouro,Numero,Latitude,Longitude,Gestor,GreId")] Escola escola) { if (ModelState.IsValid) { db.Escolas.Add(escola); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GreId = new SelectList(db.Gres, "GreId", "Regional", escola.GreId); return(View(escola)); }
public ActionResult Create([Bind(Include = "GreId,Regional,Codigo,Endereco,Referencia,Cep,Email,Tel1,Tel2,Gestor,SecretariaId")] Gre gre) { if (ModelState.IsValid) { db.Gres.Add(gre); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SecretariaId = new SelectList(db.Secretarias, "SecretariaId", "Nome", gre.SecretariaId); return(View(gre)); }
public ActionResult Create([Bind(Include = "CargoId,Nome,Descricao,TipoCargoId")] Cargo cargo) { if (ModelState.IsValid) { db.Cargoes.Add(cargo); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TipoCargoId = new SelectList(db.TipoCargoes, "TipoCargoId", "Nome", cargo.TipoCargoId); return(View(cargo)); }
public ActionResult Create([Bind(Include = "HistoricoStatusOcorrenciaSecId,Data,Observacao,StatusOcorrenciaSecId,OcorrenciaSecId")] HistoricoStatusOcorrenciaSec historicoStatusOcorrenciaSec) { if (ModelState.IsValid) { db.HistoricoStatusOcorrenciaSecs.Add(historicoStatusOcorrenciaSec); 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)); }
/*private void RemoveTeam(object ID) * { * * * int val = Convert.ToInt32(ID); * Team team = dbContext.Team.Find(val); * AdminValidation AV = new AdminValidation(); * bool correctForm = AV.RemoveTeamValidation(team); * if (correctForm) * { * dbContext.Team.Remove(team); * dbContext.SaveChanges(); * } * }*/ #endregion #region helpMethods private void addTeam() { Team team = new Team { Name = Name, NumberOfPeople = UserInNewTeam.Count(), NumberOfProjects = 0, Users = UserInNewTeam }; dbContext.Team.Add(team); dbContext.SaveChanges(); }
public ActionResult Create([Bind(Include = "TerceirizadoId,Nome,Cpf,DataAdmissao,Telefone,PrestadoraServicoId,CargoId,OcorrenciaId")] Terceirizado terceirizado) { if (ModelState.IsValid) { db.Terceirizadoes.Add(terceirizado); 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)); }
public ActionResult Create([Bind(Include = "OcorrenciaSecId,latitude,longitude,logradouro,numero,bairro,cep,cidade,estado,Data,TipoOcorrenciaSecId,DescricaoOcorrenciaSecId,SecretariaId")] OcorrenciaSec ocorrenciaSec) { if (ModelState.IsValid) { ocorrenciaSec.Data = DateTime.Now; db.OcorrenciaSecs.Add(ocorrenciaSec); 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)); }
public ActionResult Create([Bind(Include = "OcorrenciaPBId,latitude,longitude,logradouro,numero,bairro,cep,cidade,estado,Data,TipoOcorrenciaPBId,DescricaoOcorrenciaPBId,PrefeituraBairroId")] OcorrenciaPB ocorrenciaPB) { if (ModelState.IsValid) { ocorrenciaPB.Data = DateTime.Now; db.OcorrenciaPBs.Add(ocorrenciaPB); 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)); }
public ActionResult Create([Bind(Include = "OcorrenciaGreId,latitude,longitude,logradouro,numero,bairro,cep,cidade,estado,Data,TipoOcorrenciaGreId,DescricaoOcorrenciaGreId,GreId")] OcorrenciaGre ocorrenciaGre) { if (ModelState.IsValid) { ocorrenciaGre.Data = DateTime.Now; db.OcorrenciaGres.Add(ocorrenciaGre); 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)); }
public ActionResult Create([Bind(Include = "CaseId,CaseName,CaseDate,PrisonerId,JudgeName,CourtName,CaseDescription,Scheduled,EmployeeId")] Case @case) { if (ModelState.IsValid) { int id = (int)(_context.Session["employee_Id"]); @case.EmployeeId = id; @case.Scheduled = true; db.Cases.Add(@case); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PrisonerId = new SelectList(db.Prisoners, "PrisonerId", "PrisonerRegNo", @case.Prisoner.PrisonerRegNo); return(View(@case)); }
private void EditClient() { AdminValidation VM = new AdminValidation(); bool correctForm = VM.ClientValidation(FirstName, LastName, CompanyName, NIP, REGON); if (correctForm) { MySelectedClient.FirstName = FirstName; MySelectedClient.LastName = LastName; MySelectedClient.CompanyName = CompanyName; MySelectedClient.NIP = NIP; MySelectedClient.REGON = REGON; MySelectedClient.Street = Street; MySelectedClient.HouseNumber = HouseNumber; MySelectedClient.ApartmentNumber = ApartmentNumber; MySelectedClient.Postcode = Postcode; MySelectedClient.City = City; dbContext.SaveChanges(); Clients = new ObservableCollection <Client>(dbContext.Client); setVariable(); ErrorMessage er = new ErrorMessage("Client edit successfully!"); er.ShowDialog(); } }
public ActionResult Create([Bind(Include = "TrainingId,TrainingTypeId,Duration,Trained,PrisonerId,EmployeeId")] Training training) { if (ModelState.IsValid) { int id = (int)(_context.Session["employee_Id"]); training.EmployeeId = id; training.Trained = true; db.Trainings.Add(training); db.SaveChanges(); return(RedirectToAction("Success")); } //ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "FirstName", training.EmployeeId); ViewBag.PrisonerId = new SelectList(db.Prisoners, "PrisonerId", "PrisonerRegNo", training.PrisonerId); ViewBag.TrainingTypeId = new SelectList(db.TrainingTypes, "TrainingTypeId", "TrainingTypeName", training.TrainingTypeId); return(View(training)); }
public bool SaveAccommodationPackage(AccommodationPackage accommodationPackage) { var context = new PMSContext(); context.AccommodationPackages.Add(accommodationPackage); 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); }
public bool DeleteAccommodationType(AccommodationType accommodationType) { var context = new PMSContext(); context.Entry(accommodationType).State = System.Data.Entity.EntityState.Deleted; return(context.SaveChanges() > 0); }