Changeset e9bb9d1
- Timestamp:
- 08/28/24 21:41:13 (2 months ago)
- Branches:
- main
- Children:
- a850333
- Parents:
- 118e414
- Location:
- PostgreSqlDotnetCore
- Files:
-
- 5 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
PostgreSqlDotnetCore/Controllers/BlogController.cs
r118e414 re9bb9d1 89 89 } 90 90 BlogPostConsultation blogClass = db.BlogPostControllerObj.Find(id); 91 UsersClass customerClass = await getCrrentUser(); 92 ViewBag.isAuthenticated = customerClass; 91 93 if (blogClass == null) 92 94 { … … 102 104 var blogAnswers = query.ToList(); 103 105 blogClass.BlogPostAnswers = blogAnswers; 106 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 104 107 return View(blogClass); 105 108 } … … 121 124 122 125 // check for permission 123 UsersClass customerClass = await getCrrentUser(); 126 //UsersClass customerClass = await checkAuthorizationAsync(); 127 // ViewBag.isAuthenticated = await getCrrentUser(); 128 UsersClass customerClass = await getCrrentUser(); 124 129 // set if is authenticated 125 130 ViewBag.isAuthenticated = customerClass; … … 143 148 var user = await _userManager.GetUserAsync(User); 144 149 var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email); 150 //dodadeno na 25.08 151 ViewBag.isAuthenticated = await getCrrentUser(); 145 152 if (customerClass != null) 146 153 { … … 184 191 } 185 192 186 // check for permission 187 UsersClass customerClass = await checkAuthorizationAsync(); 188 //dodadeno na 23.08 193 // izbriseno na 26.08 194 UsersClass customerClass = await checkAuthorizationAsync(); 195 //dodadeno na 26.08 196 // UsersClass customerClass = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin); 189 197 ViewBag.isAuthenticated = await getCrrentUser(); 190 198 if (customerClass == null) … … 204 212 // no access for standard user 205 213 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 214 ViewBag.OnlyAdminManager1 = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 206 215 207 216 … … 233 242 if (existingBlogClass != null) 234 243 { 244 245 235 246 // Запамтете ја старата вредност на users_id 236 247 blogClass.users_id = existingBlogClass.users_id; … … 247 258 248 259 // GET: Customer/Delete/5 260 249 261 public async Task<ActionResult> DeleteAsync(int? id) 250 262 { … … 286 298 } 287 299 300 288 301 // POST: Customer/Delete/5 289 302 … … 298 311 return RedirectToAction("Index"); 299 312 } 313 314 // GET: Customer/Delete/5 315 // GET: Customer/Delete/5 316 // GET: Customer/Delete/5 317 318 300 319 301 320 protected override void Dispose(bool disposing) -
PostgreSqlDotnetCore/Controllers/BlogPostAnswersController.cs
r118e414 re9bb9d1 14 14 15 15 // GET: Customer 16 public ActionResult Index() 17 { 18 //return View(Enumerable.Empty<UsersClass>()); 16 //public ActionResult Index() 17 public async Task<ActionResult> IndexAsync() 18 { 19 //return View(Enumerable.Empty<UsersClass>()); 20 UsersClass customerClass = await getCrrentUser(); 21 22 // set if is authenticated 23 ViewBag.isAuthenticated = customerClass; 24 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 19 25 return View(db.BlogPostAnswersObj.ToList()); 20 26 } 21 27 28 29 30 22 31 // GET: Customer/Details/5 23 public ActionResult Details(int? id) 32 // public ActionResult Details(int? id) 33 public async Task<ActionResult> Details(int? id) 24 34 { 25 35 if (id == null) … … 27 37 return RedirectToAction("NotExist", "Error"); 28 38 } 39 UsersClass customerClass = await getCrrentUser(); // Добијте ја тековната улога на корисникот 40 ViewBag.isAuthenticated = customerClass; 29 41 BlogPostAnswers answerClass = db.BlogPostAnswersObj.Find(id); 30 42 if (answerClass == null) … … 32 44 return RedirectToAction("NotExist", "Error"); 33 45 } 46 47 48 // query 49 var query = from st in db.BlogPostAnswersObj 50 where st.parent_id == answerClass.id 51 select st; 52 //elenaaa 53 var answersUnderA = query.Where(x => x.id != answerClass.id).ToList(); 54 55 answerClass.blogPostAnswers = answersUnderA; 56 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 34 57 return View(answerClass); 35 58 } … … 46 69 // check for permission 47 70 UsersClass customerClass = await checkAuthorizationAsync(); 71 // UsersClass customerClass = await getCrrentUser(); 72 // set if is authenticated 73 ViewBag.isAuthenticated = customerClass; 48 74 if (customerClass == null) 49 75 { 50 76 return RedirectToAction("AccessDenied", "Error"); 51 77 } 78 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 52 79 return View(); 53 80 } … … 90 117 return RedirectToAction("Details", "Blog", new { id }); 91 118 } 119 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 92 120 93 121 return View(answerClass); … … 139 167 public async Task<ActionResult> DeleteAsync(int? id) 140 168 { 169 141 170 if (id == null) 142 171 { … … 159 188 } 160 189 } 161 return View(answerClass); 190 // return View(answerClass); 191 return View(answerClass); 162 192 } 163 193 -
PostgreSqlDotnetCore/Controllers/HomeController.cs
r118e414 re9bb9d1 1 1 using Microsoft.AspNetCore.Identity; 2 2 using Microsoft.AspNetCore.Mvc; 3 using Microsoft.EntityFrameworkCore; 3 4 using PostgreSqlDotnetCore.Data; 4 5 using PostgreSqlDotnetCore.Models; … … 30 31 if (user != null) 31 32 { 32 UsersClass customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);33 UsersClass customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email); 33 34 if (customerClass == null) 34 35 { … … 43 44 lastName = nameLastName[0].Split('.')[1]; 44 45 } 45 } catch(Exception ex) { 46 } 47 catch (Exception ex) 48 { 46 49 } 47 50 db.CustomerObj.Add(new UsersClass( … … 65 68 } 66 69 67 } else 70 } 71 else 68 72 { 69 73 ViewBag.isAuthenticated = null; … … 86 90 public async Task<IActionResult> ContactAsync() 87 91 { 92 93 //var query = db.Database.ExecuteSqlRaw("CALL get_pet_details()"); 94 //var query = db.Database.ExecuteSqlRaw("SELECT * FROM get_pet_details()"); 95 96 88 97 // set if is authenticated 89 98 ViewBag.isAuthenticated = await getCrrentUser(); -
PostgreSqlDotnetCore/Controllers/PetCaresController.cs
r118e414 re9bb9d1 36 36 ViewBag.VetCenters = new SelectList(vetCenters, "id", "name"); 37 37 38 39 // check if the user is authenticated so we can take only his pets 40 if (customerClass != null) 41 { 42 var queryPetsByUser = from st in db.PetsObj 43 where st.usersid == customerClass.id 44 select st; 45 var userPets = await queryPetsByUser.ToListAsync<PetsClass>(); 46 ViewBag.Pets = new SelectList(userPets, "id", "name"); 47 48 } 38 49 return View(); 39 50 } … … 63 74 select st; 64 75 65 var userPets = 66 //db.PetCaresObj.FromSql($"SELECT * FROM pets where usersid={customerClass.id}").ToListAsync(); 76 var userPetCares = 67 77 await query.ToListAsync<Pet_CaresClass>(); 68 78 69 return View(userPets); 70 71 PetCareAllData petCareAllData = new PetCareAllData(); 72 petCareAllData.PetCares = userPets; 73 74 75 // query 76 var queryVetCenters = from kk in db.VetCentersObj 77 select kk; 78 79 // query 80 var queryUsers = from st in db.CustomerObj 81 select st; 82 83 var users = await queryUsers.ToListAsync<UsersClass>(); 84 petCareAllData.Users = users; 85 86 //var vetCenters = await queryVetCenters.ToListAsync<VetCenter>(); 87 //petCareAllData.VetCenters = vetCenters; 88 89 return View(petCareAllData); 79 return View(userPetCares); 90 80 } 91 81 else … … 133 123 [HttpPost] 134 124 [ValidateAntiForgeryToken] 135 public async Task<ActionResult> CreateAsync([Bind(include: "id,title,description,dateending, start_date, usersid, vetcentersid ")] Pet_CaresClass peClass)125 public async Task<ActionResult> CreateAsync([Bind(include: "id,title,description,dateending, start_date, usersid, vetcentersid, pet_id")] Pet_CaresClass peClass) 136 126 { 137 127 bool isAuthenticated = User.Identity.IsAuthenticated; … … 143 133 // no access for standard user 144 134 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 145 135 UsersClass customerClass = null; 146 136 if (ModelState.IsValid) 147 137 { … … 150 140 peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc); 151 141 var user = await _userManager.GetUserAsync(User); 152 varcustomerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);142 customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email); 153 143 peClass.usersid = customerClass.id; 154 144 db.PetCaresObj.Add(peClass); … … 159 149 ViewBag.VetCenters = new SelectList(vetCenters, "id", "name"); 160 150 161 return View(peClass); 162 } 163 164 165 166 167 168 169 151 152 var queryPetsByUser = from st in db.PetsObj 153 where st.usersid == customerClass.id 154 select st; 155 var userPets =await queryPetsByUser.ToListAsync<PetsClass>(); 156 ViewBag.Pets= new SelectList(userPets, "id", "name"); 157 158 159 return View(peClass); 160 } 170 161 171 162 … … 219 210 ViewBag.VetCenters = new SelectList(vetCenters, "id", "name", peClass.vetcentersid); 220 211 // dodadeno na 22.08 221 ViewBag.isAuthenticated = await getCrrentUser(); 212 UsersClass customerClass = await getCrrentUser(); 213 // check if the user is authenticated so we can take only his pets 214 if (customerClass != null) 215 { 216 var queryPetsByUser = from st in db.PetsObj 217 where st.usersid == customerClass.id 218 select st; 219 var userPets = await queryPetsByUser.ToListAsync<PetsClass>(); 220 ViewBag.Pets = new SelectList(userPets, "id", "name"); 221 222 } 223 ViewBag.isAuthenticated = customerClass; 222 224 return View(peClass); 223 225 } … … 230 232 [HttpPost] 231 233 [ValidateAntiForgeryToken] 232 public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, vetcentersid ")] Pet_CaresClass peClass)234 public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, vetcentersid, pet_id")] Pet_CaresClass peClass) 233 235 { 234 236 bool isAuthenticated = User.Identity.IsAuthenticated; -
PostgreSqlDotnetCore/Controllers/PetsController.cs
r118e414 re9bb9d1 31 31 if (customerClass.role_id == RoleConstants.Standard) 32 32 { 33 // kco33 // filter user pets by UserID 34 34 var query = from st in db.PetsObj 35 35 where st.usersid == customerClass.id -
PostgreSqlDotnetCore/Controllers/ProductsController.cs
r118e414 re9bb9d1 48 48 } 49 49 50 51 50 52 // GET: Customer/Details/5 51 53 public async Task<ActionResult> Details(int? id) … … 55 57 return RedirectToAction("NotExist", "Error"); 56 58 } 57 UsersClass customerClass = await getCrrentUser(); 59 // додано на 28.08 60 61 62 63 64 UsersClass customerClass = await getCrrentUser(); 58 65 ViewBag.isAuthenticated = customerClass; 59 66 ProductsClass prodClass = db.ProductObj.Find(id); -
PostgreSqlDotnetCore/Controllers/VetCenterController.cs
r118e414 re9bb9d1 5 5 using Microsoft.AspNetCore.Mvc.Rendering; 6 6 using System.Threading.Tasks; 7 using Npgsql; 8 using PostgreSqlDotnetCore.Data; 7 9 8 10 namespace PostgreSqlDotnetCore.Controllers … … 10 12 public class VetCenterController : BaseController 11 13 { 12 public VetCenterController(UserManager<IdentityUser> userManager) : base(userManager) 13 { 14 /* 15 public VetCenterController(UserManager<IdentityUser> userManager) : base(userManager) 16 { 17 } 18 */ 19 private readonly ApplicationDbContext db; 20 21 public VetCenterController(UserManager<IdentityUser> userManager, ApplicationDbContext context) : base(userManager) 22 { 23 db = context ?? throw new ArgumentNullException(nameof(context)); 14 24 } 15 25 … … 45 55 return View(vetCenters); 46 56 }*/ 57 /* public async Task<ActionResult> Index() 58 { 59 var vetCenters = await db.VetCentersObj.ToListAsync(); 60 ViewBag.isAuthenticated = User.Identity.IsAuthenticated; 61 // no access for standard user 62 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 63 64 // Проверете дали корисникот е администратор или менаџер 65 UsersClass customerClass = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin); 66 // ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 67 68 ViewBag.hasAccess = customerClass != null; 69 70 return View(vetCenters); 71 } 72 */ 47 73 public async Task<ActionResult> Index() 48 74 { 49 var vetCenters = await db.VetCenters Obj.ToListAsync();75 var vetCenters = await db.VetCentersWithCity.ToListAsync(); 50 76 ViewBag.isAuthenticated = User.Identity.IsAuthenticated; 51 77 // no access for standard user 52 78 ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager); 53 79 54 // Проверете дали корисникот е администратор или менаџер80 55 81 UsersClass customerClass = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin); 56 // ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);57 82 58 83 ViewBag.hasAccess = customerClass != null; … … 62 87 63 88 64 public async Task<ActionResult> Details(int? id) 89 90 /*public async Task<ActionResult> Details(int? id) 65 91 { 66 92 if (id == null) … … 82 108 } 83 109 110 111 */ 112 public async Task<IActionResult> Details(int? id) 113 { 114 if (id == null) 115 { 116 return RedirectToAction("NotExist", "Error"); 117 } 118 119 // Логирајте го ID-то за дебугирање 120 Console.WriteLine($"ID: {id}"); 121 122 // Обидете се да најдете запис во view 123 VetCenterWithCity vetClass = await db.VetCentersWithCity 124 .Where(v => v.id == id) 125 .FirstOrDefaultAsync(); 126 if (vetClass == null) 127 { 128 return RedirectToAction("NotExist", "Error"); 129 } 130 131 132 UsersClass customerClass = await getCrrentUser(); 133 ViewBag.isAuthenticated = customerClass; 134 135 136 return View(vetClass); 137 } 138 139 140 141 142 143 144 145 146 147 148 149 84 150 [HttpPost] 85 151 [ValidateAntiForgeryToken] … … 99 165 return View(vetClass); 100 166 } 167 168 169 170 /*public async Task<ActionResult> Create([Bind(include: "id,name,adress,description,workinghours,phonenumber,latitude,longitude,citiesid")] VetCenter vetClass) 171 { 172 // Логирање на параметрите 173 Console.WriteLine($"Parameters: {vetClass.name}, {vetClass.adress}, {vetClass.description}, {vetClass.workinghours}, {vetClass.phonenumber}, {vetClass.latitude}, {vetClass.longitude}, {vetClass.citiesid}"); 174 175 if (ModelState.IsValid) 176 { 177 // Повик на складираната процедура 178 var parameters = new[] 179 { 180 new NpgsqlParameter("@name", vetClass.name), 181 new NpgsqlParameter("@adress", vetClass.adress), 182 new NpgsqlParameter("@description", vetClass.description), 183 new NpgsqlParameter("@workinghours", vetClass.workinghours), 184 new NpgsqlParameter("@phonenumber", vetClass.phonenumber), 185 new NpgsqlParameter("@latitude", (decimal)vetClass.latitude), 186 new NpgsqlParameter("@longitude", (decimal)vetClass.longitude), 187 new NpgsqlParameter("@citiesid", vetClass.citiesid) 188 }; 189 190 await db.Database.ExecuteSqlRawAsync("CALL project.AddVetCenter(@name, @adress, @description, @workinghours, @phonenumber, @latitude, @longitude, @citiesid)", parameters); 191 192 return RedirectToAction("Index"); 193 } 194 195 // Ако моделот не е валиден, повторно пополнете ги градовите за паѓачкиот мени 196 var citiess = await db.CitiesObj.ToListAsync(); 197 ViewBag.Citiess = new SelectList(citiess, "id", "name", vetClass.citiesid); 198 199 return View(vetClass); 200 } 201 202 203 204 205 */ 206 207 208 101 209 102 210 public async Task<ActionResult> Edit(int? id) … … 149 257 } 150 258 151 public async Task<ActionResult> Delete(int? id) { 152 UsersClass customerClass = await checkAuthorizationAsync(); 153 154 ViewBag.isAuthenticated = await getCrrentUser(); 155 259 public async Task<ActionResult> Delete(int? id) 260 { 261 UsersClass customerClass = await checkAuthorizationAsync(); 262 263 ViewBag.isAuthenticated = await getCrrentUser(); 264 156 265 if (id == null) 157 266 { -
PostgreSqlDotnetCore/Data/ApplicationDbContext.cs
r118e414 re9bb9d1 50 50 modelBuilder.Entity<Pet_GaleryClass>().Metadata.SetIsTableExcludedFromMigrations(true); 51 51 modelBuilder.Entity<BlogPostAnswers>().Metadata.SetIsTableExcludedFromMigrations(true); 52 53 modelBuilder.Entity<PetDetailsProcedure>().Metadata.SetIsTableExcludedFromMigrations(true); 52 54 //modelBuilder.Entity<PetCareAllData>().Metadata.SetIsTableExcludedFromMigrations(true); 53 54 55 55 56 // додадени следните два реда на 28.08 57 // modelBuilder.Entity<VetCenterWithCity>().HasNoKey(); // Дефинирајте дека VIEW-от нема примарен клуч 58 // modelBuilder.Entity<VetCenterWithCity>().ToView("vet_centers_with_city"); // Поставете го името на VIEW-от 59 modelBuilder.Entity<VetCenterWithCity>().HasNoKey().ToView("vet_centers_with_city"); 56 60 base.OnModelCreating(modelBuilder); 57 61 … … 65 69 public virtual DbSet<UsersClass> CustomerObj { get; set; } 66 70 public virtual DbSet<VetCenter> VetCentersObj { get; set; } 71 72 // додадено на 28.08 73 public virtual DbSet<VetCenterWithCity> VetCentersWithCity { get; set; } 74 67 75 public virtual DbSet<BlogPostConsultation> BlogPostControllerObj { get; set; } 68 76 public virtual DbSet<RolesClass> RoleControllerObj { get; set; } … … 83 91 public virtual DbSet<TherapyClass> theraObj { get; set; } 84 92 public virtual DbSet<Type_Of_PetsClass> typeofObj { get; set; } 93 94 public virtual DbSet<PetDetailsProcedure> PetDetailsProcedureObj { get; set; } 95 96 //public virtual DbSet<PetDetailsProcedure> AddVetCenter { get; set; } 97 85 98 } 86 99 } -
PostgreSqlDotnetCore/Models/BlogPostAnswers.cs
r118e414 re9bb9d1 19 19 20 20 public int usersid { get; set; } 21 22 [NotMapped] 23 public List<BlogPostAnswers> blogPostAnswers{ get; set; } 21 24 } 22 25 } -
PostgreSqlDotnetCore/Models/Pet_CaresClass.cs
r118e414 re9bb9d1 22 22 public DateTime start_date { get; set; } 23 23 24 // [ForeignKey("PetsClass")] 25 // [Column("petid")] 26 public int pet_id { get; set; } 27 //public PetsClass PetsClass { get; set; } 28 29 24 30 public void SetDatesToUtc() 25 31 { -
PostgreSqlDotnetCore/Models/VetCenter.cs
r118e414 re9bb9d1 9 9 namespace PostgreSqlDotnetCore.Models 10 10 { 11 [Table("vet_centers ", Schema = "project")]11 [Table("vet_centers_with_city", Schema = "project")] 12 12 public class VetCenter 13 13 { 14 [Key]14 // [Key] 15 15 public int id { get; set; } 16 16 -
PostgreSqlDotnetCore/PostgreSqlDotnetCore.csproj
r118e414 re9bb9d1 70 70 <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> 71 71 </PackageReference> 72 <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.1 1" />72 <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.12" /> 73 73 <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.1" /> 74 74 </ItemGroup> -
PostgreSqlDotnetCore/Views/Blog/Index.cshtml
r118e414 re9bb9d1 57 57 58 58 @if (item.users_id == ViewBag.CurrentUserId) 59 59 60 { 60 61 <td> … … 64 65 </td> 65 66 } 66 67 68 67 69 68 70 @if (item.users_id == ViewBag.CurrentUserId || item.users_id != ViewBag.CurrentUserId) -
PostgreSqlDotnetCore/Views/BlogPostAnswers/Details.cshtml
r118e414 re9bb9d1 29 29 </dl> 30 30 </div> 31 <br/> 32 @{ 33 if(Model.blogPostAnswers.Count > 0) 34 { 35 36 <h4>Replay under Answers</h4> 37 <hr /> 38 foreach (BlogPostAnswers item in Model.blogPostAnswers) 39 { 40 41 <dl class="dl-horizontal"> 42 <dt> 43 @Html.DisplayNameFor(model => item.parent_id) 44 </dt> 45 46 <dd> 47 @Html.DisplayFor(model => item.parent_id) 48 </dd> 49 50 <dt> 51 @Html.DisplayNameFor(model => item.reply) 52 </dt> 53 <dd> 54 @Html.DisplayFor(model => item.reply) 55 </dd> 56 57 58 </dl> 59 } 60 <hr /> 61 } 62 } 31 63 <p> 32 64 @Html.ActionLink("Edit", "Edit", new { id = Model.id }) | -
PostgreSqlDotnetCore/Views/PetCares/Create.cshtml
r118e414 re9bb9d1 74 74 </div> 75 75 76 <div class="form-group"> 77 <label class="control-label col-md-2" for="pet_id">UserPet:</label> 78 <div class="col-md-10"> 79 @Html.DropDownList("pet_id", (SelectList)ViewBag.Pets, "Select Pets", new { @class = "form-control" }) 80 </div> 81 </div> 82 76 83 77 84 <div class="form-group"> -
PostgreSqlDotnetCore/Views/Products/Index.cshtml
r118e414 re9bb9d1 108 108 @Html.ActionLink("Details", "Details", new { id = item.id }) | 109 109 @Html.ActionLink("Delete", "Delete", new { id = item.id }) 110 @Html.ActionLink("Procedure", "Procedure", new { id = item.id }) 110 111 </div> 111 112 } -
PostgreSqlDotnetCore/Views/VetCenter/Details.cshtml
r118e414 re9bb9d1 1 @model PostgreSqlDotnetCore.Models.VetCenter 1 @model PostgreSqlDotnetCore.Models.VetCenterWithCity 2 2 3 3 @{ … … 5 5 } 6 6 7 <h2>Details </h2>7 <h2>Details for @Model.vet_center_name</h2> 8 8 9 <div> 10 <h4>VetCenter</h4> 11 <hr /> 12 <dl class="dl-horizontal"> 13 <dt> 14 @Html.DisplayNameFor(model => model.name) 15 </dt> 9 <table class="table"> 10 <tr> 11 <th>@Html.DisplayNameFor(model => model.vet_center_name)</th> 12 <td>@Html.DisplayFor(model => model.vet_center_name)</td> 13 </tr> 14 <tr> 15 <th>@Html.DisplayNameFor(model => model.adress)</th> 16 <td>@Html.DisplayFor(model => model.adress)</td> 17 </tr> 18 <tr> 19 <th>@Html.DisplayNameFor(model => model.workinghours)</th> 20 <td>@Html.DisplayFor(model => model.workinghours)</td> 21 </tr> 22 <tr> 23 <th>@Html.DisplayNameFor(model => model.description)</th> 24 <td>@Html.DisplayFor(model => model.description)</td> 25 </tr> 26 <tr> 27 <th>@Html.DisplayNameFor(model => model.phonenumber)</th> 28 <td>@Html.DisplayFor(model => model.phonenumber)</td> 29 </tr> 30 <tr> 31 <th>@Html.DisplayNameFor(model => model.latitude)</th> 32 <td>@Html.DisplayFor(model => model.latitude)</td> 33 </tr> 34 <tr> 35 <th>@Html.DisplayNameFor(model => model.longitude)</th> 36 <td>@Html.DisplayFor(model => model.longitude)</td> 37 </tr> 38 <tr> 39 <th>@Html.DisplayNameFor(model => model.city_name)</th> 40 <td>@Html.DisplayFor(model => model.city_name)</td> 41 </tr> 42 </table> 16 43 17 <dd> 18 @Html.DisplayFor(model => model.name) 19 </dd> 44 @if (ViewBag.hasAccess != null && ViewBag.hasAccess == true) 45 { 46 <p> 47 @Html.ActionLink("Edit", "Edit", new { id = Model.id }) | 48 @Html.ActionLink("Delete", "Delete", new { id = Model.id }) 49 </p> 50 } 20 51 21 <dt>22 @Html.DisplayNameFor(model => model.adress)23 </dt>24 25 <dd>26 @Html.DisplayFor(model => model.adress)27 </dd>28 <dt>29 @Html.DisplayNameFor(model => model.description)30 </dt>31 32 <dd>33 @Html.DisplayFor(model => model.description)34 </dd>35 <dt>36 @Html.DisplayNameFor(model => model.workinghours)37 </dt>38 39 <dd>40 @Html.DisplayFor(model => model.workinghours)41 </dd>42 <dt>43 @Html.DisplayNameFor(model => model.phonenumber)44 </dt>45 46 <dd>47 @Html.DisplayFor(model => model.phonenumber)48 </dd>49 <dt>50 @Html.DisplayNameFor(model => model.latitude)51 </dt>52 53 <dd>54 @Html.DisplayFor(model => model.latitude)55 </dd>56 <dt>57 @Html.DisplayNameFor(model => model.longitude)58 </dt>59 60 <dd>61 @Html.DisplayFor(model => model.longitude)62 </dd>63 <dt>64 @Html.DisplayNameFor(model => model.citiesid)65 </dt>66 67 <dd>68 @Html.DisplayFor(model => model.citiesid)69 </dd>70 71 72 </dl>73 </div>74 52 <p> 75 @Html.ActionLink("Edit", "Edit", new { id = Model.id }) |76 53 @Html.ActionLink("Back to List", "Index") 77 54 </p> -
PostgreSqlDotnetCore/Views/VetCenter/Index.cshtml
r118e414 re9bb9d1 1 1 @using Microsoft.AspNetCore.Identity 2 2 @inject SignInManager<IdentityUser> SignInManager 3 @model IEnumerable<PostgreSqlDotnetCore.Models.VetCenter> 3 @* IEnumerable<PostgreSqlDotnetCore.Models.VetCenter>*@ 4 @model IEnumerable<PostgreSqlDotnetCore.Models.VetCenterWithCity> 5 4 6 5 7 @{ … … 23 25 <tr> 24 26 <th> 25 @Html.DisplayNameFor(model => model. name)27 @Html.DisplayNameFor(model => model.vet_center_name) 26 28 </th> 27 29 <th> … … 45 47 </th> 46 48 <th> 47 @Html.DisplayNameFor(model => model.cit iesid)49 @Html.DisplayNameFor(model => model.city_name) 48 50 </th> 49 51 <th></th> … … 54 56 <tr> 55 57 <td> 56 @Html.DisplayFor(modelItem => item. name)58 @Html.DisplayFor(modelItem => item.vet_center_name) 57 59 </td> 58 60 <td> … … 76 78 </td> 77 79 <td> 78 @Html.DisplayFor(modelItem => item.cit iesid)80 @Html.DisplayFor(modelItem => item.city_name) 79 81 </td> 80 82 <td> … … 85 87 </td> 86 88 87 88 89 89 @* @if ((SignInManager.IsSignedIn(User)))90 {91 <td>92 90 93 @Html.ActionLink("Edit", "Edit", new { id = item.id }) |94 @Html.ActionLink("Details", "Details", new { id = item.id }) |95 @Html.ActionLink("Delete", "Delete", new { id = item.id })91 @* @if ((SignInManager.IsSignedIn(User))) 92 { 93 <td> 96 94 97 </td> 98 } 99 *@ 95 @Html.ActionLink("Edit", "Edit", new { id = item.id }) | 96 @Html.ActionLink("Details", "Details", new { id = item.id }) | 97 @Html.ActionLink("Delete", "Delete", new { id = item.id }) 98 99 </td> 100 } 101 *@ 100 102 101 103 @* Додадете условие за проверка на улогите *@
Note:
See TracChangeset
for help on using the changeset viewer.