Exemple #1
0
        public ActionResult EditGalsa(int id, elgalasat _galasa, DateTime dateOfGalsa)
        {
            ViewBag.Courts = new SelectList(_db.Court.ToList(), "id", "CourtName");


            if (ModelState.IsValid)
            {
                _galasa.dateOfGalsa      = dateOfGalsa;
                _db.Entry(_galasa).State = EntityState.Modified;
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(_galasa));
        }
Exemple #2
0
        public ActionResult Edit(Employees _emp, HowCanAcess hca)
        {
            if (Session["empName"] != null)
            {
                ViewBag.Offices = new SelectList(_db.Offices.ToList(), "id", "OfficeName");
                ViewBag.Jobs    = new SelectList(_db.Jobs.ToList(), "id", "jobs");

                if (_emp != null)
                {
                    _db.Entry(_emp).State = EntityState.Modified;
                    _db.SaveChanges();
                    TempData["EditEmp"] = "تم التعديل بنجاح";
                    return(RedirectToAction("Index"));
                }

                return(View(_emp));
            }
            return(RedirectToAction("HavntAccess", "Employees"));
        }
Exemple #3
0
        public ActionResult EditPayMoney(int id, Salaries _salary, string months)
        {
            ViewBag.Month = new SelectList(_db.Month.ToList(), "id", "months");


            if (ModelState.IsValid)
            {
                _salary.Employee = Session["id"].ToString();

                _salary.empSupplyer = Session["empName"].ToString();

                _db.Entry(_salary).State = EntityState.Modified;
                _salary.Date             = DateTime.Now;
                _salary.month            = months;
                _db.SaveChanges();
                return(RedirectToAction("Salary/" + Session["id"]));
            }
            return(View(_salary));
        }
        public ActionResult Edit(Client client)
        {
            ViewBag.Employee = new SelectList(_db.Employee.Where(s => s.jobs.ToString() == "1"), "id", "employeeName");

            if (ModelState.IsValid)
            {
                _db.Entry(client).State = EntityState.Modified;
                _db.SaveChanges();
                TempData["ClientEdit"] = "تم التعديل بنجاح  ";

                return(RedirectToAction("Index"));
            }
            return(View(client));
        }
Exemple #5
0
        public IHttpActionResult Delete(int id)
        {
            if (id <= 0)
            {
                return(BadRequest("Not a valid lawyer id"));
            }

            using (var ctx = new LawyerContext())
            {
                var lawyer = ctx.Lawyers
                             .Where(l => l.Id == id)
                             .FirstOrDefault();

                ctx.Entry(lawyer).State = System.Data.Entity.EntityState.Deleted;
                ctx.SaveChanges();
            }

            return(Ok());
        }