diff --git a/CheckDrive.Web/CheckDrive.Web/Controllers/AccountsController.cs b/CheckDrive.Web/CheckDrive.Web/Controllers/AccountsController.cs index 1269cfc2..4fca51a4 100644 --- a/CheckDrive.Web/CheckDrive.Web/Controllers/AccountsController.cs +++ b/CheckDrive.Web/CheckDrive.Web/Controllers/AccountsController.cs @@ -27,7 +27,7 @@ public async Task Index(string? searchString, int? roleId, DateTi { var accounts = await _accountDataStore.GetAccountsAsync(searchString, roleId, birthDate, pageNumber); - var roles = await GETRoles(); + var roles = await GetRolesAsync(); roles.Insert(0, new RoleDto { @@ -88,7 +88,7 @@ public async Task Details(int id) } public async Task Create() { - var roles = await GETRoles(); + var roles = await GetRolesAsync(); ViewBag.Roles = new SelectList(roles, "Id", "Name"); return View(); } @@ -102,7 +102,7 @@ public async Task Create([Bind("Login,Password,PhoneNumber,FirstN var newAccount = await _accountDataStore.CreateAccountAsync(account); return RedirectToAction("Details", new {id = newAccount.Id}); } - var roles = await GETRoles(); + var roles = await GetRolesAsync(); ViewBag.Roles = new SelectList(roles, "Id", "Name"); return View(account); } @@ -110,7 +110,9 @@ public async Task Create([Bind("Login,Password,PhoneNumber,FirstN public async Task Edit(int id) { var account = await _accountDataStore.GetAccountAsync(id); - + var roles = await GetRolesAsync(); + ViewBag.Roles = new SelectList(roles, "Id", "Name"); + return View(account); } @@ -122,7 +124,7 @@ public async Task Edit(int id, [Bind("Id,Login,Password,PhoneNumb if (ModelState.IsValid) { var newAccount = await _accountDataStore.UpdateAccountAsync(id, account); - return RedirectToAction("Details", new { id = newAccount.Id }); + return RedirectToAction(nameof(Index)); } return View(account); } @@ -145,7 +147,7 @@ public async Task DeleteConfirmed(int id) return RedirectToAction(nameof(Index)); } - private async Task> GETRoles() + private async Task> GetRolesAsync() { var roleResponse = await _roleStore.GetRoles(); var roles = roleResponse.Data.ToList(); diff --git a/CheckDrive.Web/CheckDrive.Web/Controllers/CarsController.cs b/CheckDrive.Web/CheckDrive.Web/Controllers/CarsController.cs index 0b6f308f..5b43280b 100644 --- a/CheckDrive.Web/CheckDrive.Web/Controllers/CarsController.cs +++ b/CheckDrive.Web/CheckDrive.Web/Controllers/CarsController.cs @@ -109,7 +109,7 @@ public async Task Create([Bind("Model,Color,Number,RemainingFuel, if (ModelState.IsValid) { var newCar = await _carDataStore.CreateCarAsync(car); - return RedirectToAction("Details", new { id = newCar.Id }); + return RedirectToAction(nameof(Index)); } return View(car); } @@ -131,7 +131,7 @@ public async Task Edit(int id, [Bind("Id,Model,Color,Number,Remai if (ModelState.IsValid) { var newCar = await _carDataStore.UpdateCarAsync(id, car); - return RedirectToAction("Details", new { id = newCar.Id }); + return RedirectToAction(nameof(Index)); } return View(car); } diff --git a/CheckDrive.Web/CheckDrive.Web/Stores/Menu/MenuService.cs b/CheckDrive.Web/CheckDrive.Web/Stores/Menu/MenuService.cs index 33b94cda..cb05c540 100644 --- a/CheckDrive.Web/CheckDrive.Web/Stores/Menu/MenuService.cs +++ b/CheckDrive.Web/CheckDrive.Web/Stores/Menu/MenuService.cs @@ -46,7 +46,7 @@ public List GetMenuItems(string role) { text = "Yoqilg'ilar", iconCss = "fa-solid fa-gas-pump", - url = "/#" + url = "/oilMarks" }); menuItems.Add(new diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Create.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Create.cshtml index 956cf7c5..f01a01ce 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Create.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Create.cshtml @@ -2,7 +2,7 @@ @{ ViewData["Title"] = "Create"; - Layout = null; + Layout = "~/Views/Shared/_LayoutForModal.cshtml"; } diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Delete.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Delete.cshtml index c631311c..6d2b14f7 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Delete.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Delete.cshtml @@ -2,78 +2,25 @@ @{ ViewData["Title"] = "Delete"; - Layout = "~/Views/Shared/_Layout.cshtml"; + Layout = "~/Views/Shared/_LayoutForModal.cshtml"; } - -

O'chirish

-
- -

Haqiqatan ham buni oʻchirib tashlamoqchimisiz? - O'chirsangiz bu shaxs ishtirok etgan barcha ma'lumotlar ham o'chiriladi!!! -

+

+

+ Haqiqatan ham @Model.FirstName @Model.LastNameni oʻchirib tashlamoqchimisiz? + O'chirsangiz bu shaxs ishtirok etgan barcha ma'lumotlar ham o'chiriladi!!! +

-
-
-
- Id: -
-
- @Html.DisplayFor(model => model.Id) -
-
- Ism: -
-
- @Html.DisplayFor(model => model.FirstName) -
-
- Familiya: -
-
- @Html.DisplayFor(model => model.LastName) -
-
- Tug'ilgan kun: -
-
- @(Model.Bithdate.ToString("yyyy-MM-dd")) -
-
- Telefon raqam: -
-
- @Html.DisplayFor(model => model.PhoneNumber) -
-
- Login: -
-
- @Html.DisplayFor(model => model.Login) -
-
- Parol: -
-
- @Html.DisplayFor(model => model.Password) -
-
- Kasb: -
-
- @Html.DisplayFor(model => model.RoleName) -
-
- -
-
- - - Orqaga - - +
+ + diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Details.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Details.cshtml index 7fec05d8..c71fc614 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Details.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Accounts/Details.cshtml @@ -3,7 +3,7 @@ @{ ViewData["Title"] = "Details"; - Layout = null; + Layout = "~/Views/Shared/_LayoutForModal.cshtml"; }