public ActionResult ChangeOrderStatus(int id, int newStatus) { _employeesHelper.ChangeOrderStatus(id, newStatus); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie zmieniono status!"); return(Json(new { success = true, data = "" }, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteKey(int id) { _employeesHelper.DeleteKey(id); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto kod!"); return(RedirectToAction("RegisterKeys")); }
public ActionResult DeleteOrder(int id) { _employeesHelper.DeleteOrder(id); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usnięto zamówienie!"); return(RedirectToAction("OrderManagment")); }
public ActionResult MakeAdmin(int id) { _employeesHelper.MakeAdmin(id); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie nadano uprawnienia!"); return(RedirectToAction("EmployeeManagment")); }
public ActionResult DeleteItem(int id) { _employeesHelper.DeleteItem(id); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto produkt!"); return(RedirectToAction("ItemsManagment")); }
public ActionResult DeleteOpinion(int id) { _employeesHelper.DeleteOpinion(id); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto opinię!"); return(RedirectToAction("Opinions")); }
public ActionResult ItemAdd(ItemModel model, List <HttpPostedFileBase> fileUpload) { _employeesHelper.AddProduct(model, fileUpload); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie dodano produkt!"); return(RedirectToAction("ItemsManagment")); }
public ActionResult ItemsEdit(ItemModel model) { _employeesHelper.EditProduct(model, Request.Files); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie zmodyfikowano produkt!"); return(RedirectToAction("ItemsManagment")); }
public async Task <IActionResult> Edit(int id, [Bind("AlertId,EmployeeId,Alert")] EmployeeAlert employeeAlert) { if (id != employeeAlert.AlertId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employeeAlert); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeAlertExists(employeeAlert.AlertId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employee, "EmployeeId", "Firstname", employeeAlert.EmployeeId); return(View(employeeAlert)); }
public override void OnAuthorization(AuthorizationContext filterContext) { var session = filterContext.HttpContext.Session["Employee"] as employees; var rule = session.Id_Rule; if (rule != (int)Rules.Admin) { filterContext.Result = new RedirectResult("/Pracownik/Konto"); filterContext.Controller.TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Danger, "Nie masz uprawnień do tego typu operacji!"); } }
public async Task <IActionResult> Create([Bind("AlertId,EmployeeId,Alert")] EmployeeAlert employeeAlert) { if (ModelState.IsValid) { _context.Add(employeeAlert); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employee, "EmployeeId", "Firstname", employeeAlert.EmployeeId); return(View(employeeAlert)); }
public ActionResult ClientDelete(int id) { var result = _employeesHelper.TryDeleteClient(id); if (result) { TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto klienta!"); } else { TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Danger, "Brak możliwości usunięcia! Klient posiada aktywne zamówienia!"); } return(RedirectToAction("ClientManagment")); }
public ActionResult DeleteAdmin(int id) { var session = Session["Employee"] as employees; if (session.Id == id) { TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Danger, "Nie możesz sam sobie odebrać uprawnień!"); } else { _employeesHelper.DeleteAdmin(id); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie odebrano uprawnienia!"); } return(RedirectToAction("EmployeeManagment")); }
public ActionResult DeleteEmployee(int id) { var seesion = Session["Employee"] as employees; if (seesion.Id == id) { TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Danger, "Nie możesz usunąć samego siebie!"); } else { _employeesHelper.DeleteEmployee(id); TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto pracownika!"); } return(RedirectToAction("EmployeeManagment")); }