Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            TailoringEmployee tailoringEmployee = db.Tailors.Find(id);

            db.Tailors.Remove(tailoringEmployee);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "TailoringEmployeeId,StaffName,MobileNo,JoiningDate,LeavingDate,IsWorking")] TailoringEmployee tailoringEmployee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tailoringEmployee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tailoringEmployee));
 }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "TailoringEmployeeId,StaffName,MobileNo,JoiningDate,LeavingDate,IsWorking")] TailoringEmployee tailoringEmployee)
        {
            if (ModelState.IsValid)
            {
                db.Tailors.Add(tailoringEmployee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tailoringEmployee));
        }
        public async Task <IActionResult> Create([Bind("TailoringEmployeeId,StaffName,MobileNo,JoiningDate,LeavingDate,IsWorking")] TailoringEmployee tailoringEmployee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tailoringEmployee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView(tailoringEmployee));
        }
Ejemplo n.º 5
0
        // GET: TailoringEmployees/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TailoringEmployee tailoringEmployee = db.Tailors.Find(id);

            if (tailoringEmployee == null)
            {
                return(HttpNotFound());
            }
            return(View(tailoringEmployee));
        }
        [Authorize(Roles = "Admin,PowerUser")]     public async Task <IActionResult> Edit(int id, [Bind("TailoringEmployeeId,StaffName,MobileNo,JoiningDate,LeavingDate,IsWorking")] TailoringEmployee tailoringEmployee)
        {
            if (id != tailoringEmployee.TailoringEmployeeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tailoringEmployee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TailoringEmployeeExists(tailoringEmployee.TailoringEmployeeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView(tailoringEmployee));
        }