Ignore:
Timestamp:
08/30/24 02:20:42 (3 months ago)
Author:
ElenaMoskova <elena.moskova99@…>
Branches:
main
Children:
a3ce071
Parents:
e90ba32
Message:

fix update/create petcares

add new field modify functions

Location:
PostgreSqlDotnetCore/Controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • PostgreSqlDotnetCore/Controllers/PetCaresController.cs

    re90ba32 r99d0ecc  
    131131                return RedirectToAction("AccessDenied", "Error");
    132132            }
     133            ModelState.Remove("PetsClass");
    133134            ViewBag.isAuthenticated = new UsersClass();
    134135            // no access for standard user
     
    150151            ViewBag.VetCenters = new SelectList(vetCenters, "id", "name");
    151152
    152 
    153             var queryPetsByUser = from st in db.PetsObj
    154                                   where st.usersid == customerClass.id
    155                                   select st;
    156             var userPets =await queryPetsByUser.ToListAsync<PetsClass>();
    157             ViewBag.Pets= new SelectList(userPets, "id", "name");
    158 
     153            if (customerClass != null)
     154            {
     155                var queryPetsByUser = from st in db.PetsObj
     156                                      where st.usersid == customerClass.id
     157                                      select st;
     158                var userPets = await queryPetsByUser.ToListAsync<PetsClass>();
     159                ViewBag.Pets = new SelectList(userPets, "id", "name");
     160
     161            }
    159162
    160163            return View(peClass);
     
    240243                return RedirectToAction("AccessDenied", "Error");
    241244            }
     245
     246            ModelState.Remove("PetsClass");
    242247            ViewBag.isAuthenticated = await getCrrentUser();
    243248            // no access for standard user
  • PostgreSqlDotnetCore/Controllers/VetCenterController.cs

    re90ba32 r99d0ecc  
    7373        public async Task<ActionResult> Index()
    7474        {
     75            ViewBag.isAuthenticated = await getCrrentUser();
     76            ViewBag.hasAccess = await checkAuthorizationAsync();
    7577            var vetCenters = await db.VetCentersWithCity.ToListAsync();
    76             ViewBag.isAuthenticated = User.Identity.IsAuthenticated;
     78           // ViewBag.isAuthenticated = User.Identity.IsAuthenticated;
    7779            // no access for standard user
    7880            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
Note: See TracChangeset for help on using the changeset viewer.