Changeset 118e414 for PostgreSqlDotnetCore/Controllers/PetsController.cs
- Timestamp:
- 08/23/24 15:40:14 (2 months ago)
- Branches:
- main
- Children:
- e9bb9d1
- Parents:
- 72b1da2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PostgreSqlDotnetCore/Controllers/PetsController.cs
r72b1da2 r118e414 26 26 return RedirectToAction("AccessDenied", "Error"); 27 27 } 28 // no access for standard user 29 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 30 28 31 if (customerClass.role_id == RoleConstants.Standard) 29 32 { 30 33 // kco 31 34 var query = from st in db.PetsObj 32 35 where st.usersid == customerClass.id 33 36 select st; … … 37 40 await query.ToListAsync<PetsClass>(); 38 41 return View(userPets); 39 } else 42 } 43 else 40 44 { 41 45 return View(db.PetsObj.ToList()); … … 74 78 return RedirectToAction("NotExist", "Error"); 75 79 } 80 // no access for standard user 81 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 82 76 83 77 84 return View(peClass); … … 109 116 } 110 117 ViewBag.isAuthenticated = new UsersClass(); 118 // no access for standard user 119 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 111 120 112 121 if (ModelState.IsValid) … … 119 128 peClass.usersid = customerClass.id; 120 129 // voa go pisav tuka na 18.02 121 // PetsClass.dateofbirthday = DateOnly.FromDateTime(DateTime.UtcNow);130 // PetsClass.dateofbirthday = DateOnly.FromDateTime(DateTime.UtcNow); 122 131 db.PetsObj.Add(peClass); 123 132 db.SaveChanges(); … … 143 152 // додадено на 21.08 144 153 ViewBag.isAuthenticated = await getCrrentUser(); 154 // no access for standard user 155 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 156 145 157 return View(peClass); 146 158 } … … 167 179 ViewBag.isAuthenticated = await getCrrentUser(); 168 180 //ViewBag.isAuthenticated = new UsersClass(); 169 170 181 // no access for standard user 182 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 183 184 171 185 if (ModelState.IsValid) 172 186 { 173 187 //peClass.dateofbirthday = DateTime.SpecifyKind(peClass.dateofbirthday, DateTimeKind.Utc); 174 188 175 189 var user = await _userManager.GetUserAsync(User); 176 190 var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email); … … 213 227 return RedirectToAction("NotExist", "Error"); 214 228 } 229 // no access for standard user 230 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 231 215 232 216 233 return View(peClass);
Note:
See TracChangeset
for help on using the changeset viewer.