public ActionResult Edit([Bind(Include = "id_usuario,login_usuario,senha,pessoa_id_pessoa")] usuario usuario)
        {
            if (ModelState.IsValid)
            {
                db.Entry(usuario).State = EntityState.Modified;

                usuario us = db.usuario.Find(usuario.id_usuario);

                if (!us.senha.Equals(usuario.senha))
                {
                    usuario.senha = Criptografia.Codifica(usuario.senha);
                }
                else
                {
                    usuario.senha = us.senha;
                }
                usuario.senha = Criptografia.Codifica(usuario.senha);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            var listaPessoasDisponiveis = db.pessoa.Where(x => x.id_pessoa.Equals(usuario.pessoa_id_pessoa));

            ViewBag.pessoa_id_pessoa = new SelectList(listaPessoasDisponiveis, "id_pessoa", "nome");
            return(View(usuario));
        }
 public ActionResult Edit([Bind(Include = "id_pessoa,nome,sobrenome,email,cpf")] pessoa pessoa)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pessoa).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pessoa));
 }
Example #3
0
 public ActionResult Update(User u, HttpPostedFileBase file)
 {
     TempData["notice"] = "Successfully Updated";
     u.user_type        = Convert.ToInt32(Session["UserType"]);
     if (u.Photo == null && file == null)
     {
         ModelState.AddModelError("", "Photo Is empty , upload it please");
     }
     else
     {
         if (file != null)
         {
             var allowedExtensions = new[] { ".Jpg", ".png", ".jpg", "jpeg" };
             if (!(allowedExtensions.Contains(file.FileName.Substring(file.FileName.LastIndexOf('.')))))
             {
                 ModelState.AddModelError("", "Wrong File ");
             }
             else
             {
                 var fileName = Path.GetFileName(file.FileName);
                 var paths    = Path.Combine(Server.MapPath("~/Img"), fileName);
                 file.SaveAs(paths);
                 u.Photo = "/Img/" + fileName;
             }
         }
         if (ModelState.IsValid)
         {
             db.Entry(u).State = EntityState.Modified;
             db.SaveChanges();
         }
     }
     return(View(u));
 }
Example #4
0
        public IHttpActionResult PuttblAdmin(int id, tblAdmin tblAdmin)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tblAdmin.AdminID)
            {
                return(BadRequest());
            }

            db.Entry(tblAdmin).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tblAdminExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #5
0
        public ActionResult Edit(RegisterUser Registers)
        {
            Database1Entities1 dc = new Database1Entities1();

            dc.Entry(Registers).State = EntityState.Modified;
            dc.SaveChanges();
            return(RedirectToAction("Admin", "House"));
        }
Example #6
0
        public ActionResult EditProfile(RegisterUser Registers)
        {
            Database1Entities1 dc = new Database1Entities1();

            dc.Entry(Registers).State = EntityState.Modified;
            dc.SaveChanges();
            return(RedirectToAction("UserData", "User"));
        }
Example #7
0
 public ActionResult Edit([Bind(Include = "Id,Title,Description,Developer,Publisher,Release,Price")] Game game)
 {
     if (ModelState.IsValid)
     {
         db.Entry(game).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(game));
 }
Example #8
0
 public ActionResult Edit([Bind(Include = "Supplier_ID,Name,PhoneNum,Address")] Supplier supplier)
 {
     if (ModelState.IsValid)
     {
         db.Entry(supplier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(supplier));
 }
Example #9
0
 public ActionResult Edit([Bind(Include = "AEmail,Job_id,Status")] Apply_Job apply_Job)
 {
     if (ModelState.IsValid)
     {
         db.Entry(apply_Job).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(apply_Job));
 }
Example #10
0
 public ActionResult Edit([Bind(Include = "Id,PublisherName")] Publisher publisher)
 {
     if (ModelState.IsValid)
     {
         db.Entry(publisher).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(publisher));
 }
Example #11
0
 public ActionResult Edit([Bind(Include = "Batch_Id,Batch_Name,Batch_Date,Batch_Time,Subject,Trainer_Name,Student_Name")] Schedule schedule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(schedule).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(schedule));
 }
Example #12
0
 public ActionResult Edit([Bind(Include = "Id,Name,Address,PhoneNo,Details_About_Comapny,Email,Password")] Company_Details company_Details)
 {
     if (ModelState.IsValid)
     {
         db.Entry(company_Details).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(company_Details));
 }
Example #13
0
 public ActionResult Edit([Bind(Include = "Id,ulica,numerDomu,numerMieszkania,miasto,kod")] Adres adres)
 {
     if (ModelState.IsValid)
     {
         db.Entry(adres).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(adres));
 }
Example #14
0
 public ActionResult Edit([Bind(Include = "Emp_ID,password,name,email,no_acc")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }
Example #15
0
 public ActionResult EditProj(Project project)
 {
     if (ModelState.IsValid)
     {
         db.Entry(project).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("listProj"));
     }
     return(View(project));
 }
Example #16
0
 public ActionResult Edit([Bind(Include = "Pid,Price,Hot,Show,Pname")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(product));
 }
 public ActionResult Edit([Bind(Include = "TId,TName,TDOB,TDateofjoin,TSalary,TQualification,TSchedule,TEmail,TPWD")] Trainer_Details trainer_Details)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trainer_Details).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(trainer_Details));
 }
 public ActionResult Edit([Bind(Include = "id_grupo,nome_grupo")] grupo grupo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(grupo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(grupo));
 }
 public ActionResult Edit([Bind(Include = "Id,Comapany_Name,Job_Descripation,Requirements,Salary,Contact_Info,Email,Require_Qualification")] Post_Job post_Job)
 {
     if (ModelState.IsValid)
     {
         db.Entry(post_Job).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(post_Job));
 }
Example #20
0
 public ActionResult Edit([Bind(Include = "CategoryId,CategoryName")] CategoryMaster categoryMaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categoryMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(categoryMaster));
 }
 public ActionResult Edit(Project project)
 {
     if (ModelState.IsValid)
     {
         db.Entry(project).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("listProj"));
     }
     ViewBag.user_id = new SelectList(db.Users, "ID", "FirstName", project.user_id);
     return(View(project));
 }
 public ActionResult Edit([Bind(Include = "Stock_ID,Stock_Name,Quantity,Price,Supplier_ID")] Stock stock)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stock).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Supplier_ID = new SelectList(db.Suppliers, "Supplier_ID", "Name", stock.Supplier_ID);
     return(View(stock));
 }
 public ActionResult Edit([Bind(Include = "CityId,CityName,RefStateId")] CityMaster cityMaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cityMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RefStateId = new SelectList(db.StateMasters, "StateId", "StateName", cityMaster.RefStateId);
     return(View(cityMaster));
 }
Example #24
0
 public ActionResult Edit([Bind(Include = "ProductId,ProductName,RefSubCategoryId,price,Description,ProductImage")] ProductMaster productMaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RefSubCategoryId = new SelectList(db.SubCategoryMasters, "SubCategoryId", "SubCategoryName", productMaster.RefSubCategoryId);
     return(View(productMaster));
 }
Example #25
0
 public ActionResult Edit([Bind(Include = "Id,imie,nazwisko,pesel,email,telefon,adresId")] Pracownik pracownik)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pracownik).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.adresId = new SelectList(db.Adres, "Id", "ulica", pracownik.adresId);
     return(View(pracownik));
 }
 public ActionResult Edit([Bind(Include = "SubCategoryId,SubCategoryName,RefCategoryId")] SubCategoryMaster subCategoryMaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subCategoryMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RefCategoryId = new SelectList(db.CategoryMasters, "CategoryId", "CategoryName", subCategoryMaster.RefCategoryId);
     return(View(subCategoryMaster));
 }
 public ActionResult Edit([Bind(Include = "seq,id_usuario,id_grupo")] usuario_grupo usuario_grupo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(usuario_grupo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_grupo   = new SelectList(db.grupo, "id_grupo", "nome_grupo", usuario_grupo.id_grupo);
     ViewBag.id_usuario = new SelectList(db.usuario, "id_usuario", "login_usuario", usuario_grupo.id_usuario);
     return(View(usuario_grupo));
 }
Example #28
0
 public ActionResult Edit(Team team)
 {
     if (ModelState.IsValid)
     {
         db.Entry(team).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MD_id      = new SelectList(db.Users, "ID", "FirstName", team.MD_id);
     ViewBag.Trainee_id = new SelectList(db.Users, "ID", "FirstName", team.Trainee_id);
     return(View(team));
 }
Example #29
0
 public ActionResult Edit([Bind(Include = "TransactionNo,Emp_ID,Stock_ID,TQuantity,TotalPrice,Date")] Transaction transaction)
 {
     if (ModelState.IsValid)
     {
         db.Entry(transaction).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Emp_ID   = new SelectList(db.Employees, "Emp_ID", "password", transaction.Emp_ID);
     ViewBag.Stock_ID = new SelectList(db.Stocks, "Stock_ID", "Stock_Name", transaction.Stock_ID);
     return(View(transaction));
 }
 public ActionResult Edit([Bind(Include = "CartId,Qty,refAdminId,refProductId,Date,refUserId")] CartMaster cartMaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cartMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.refProductId = new SelectList(db.ProductMasters, "ProductId", "ProductName", cartMaster.refProductId);
     ViewBag.refUserId    = new SelectList(db.UserMasters, "UserId", "userFirstName", cartMaster.refUserId);
     return(View(cartMaster));
 }