Changeset 8f8226c
- Timestamp:
- 08/20/24 15:04:19 (3 months ago)
- Branches:
- main
- Children:
- 6782104
- Parents:
- ae6c071
- Location:
- PostgreSqlDotnetCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
PostgreSqlDotnetCore/Controllers/BlogController.cs
rae6c071 r8f8226c 44 44 // query 45 45 var query = from st in db.BlogPostAnswersObj 46 where st. blogpostconsultationid == blogClass.id46 where st.BlogPostConsultationid == blogClass.id 47 47 select st; 48 48 //elenaaa -
PostgreSqlDotnetCore/Controllers/PetCaresController.cs
rae6c071 r8f8226c 130 130 131 131 // GET: Customer/Edit/5 132 public ActionResult Edit(int? id) 132 /* public ActionResult Edit(int? id) 133 { 134 if (id == null) 135 { 136 return RedirectToAction("NotExist", "Error"); 137 } 138 Pet_CaresClass peClass = db.PetCaresObj.Find(id); 139 if (peClass == null) 140 { 141 return RedirectToAction("NotExist", "Error"); 142 } 143 144 145 return View(peClass); 146 }*/ 147 // GET: Customer/Edit/5 148 /* public ActionResult Edit(int? id) 149 { 150 if (id == null) 151 { 152 return RedirectToAction("NotExist", "Error"); 153 } 154 Pet_CaresClass peClass = db.PetCaresObj.Find(id); 155 if (peClass == null) 156 { 157 return RedirectToAction("NotExist", "Error"); 158 } 159 160 161 return View(peClass); 162 }*/ 163 public async Task<ActionResult> Edit(int? id) 133 164 { 134 165 if (id == null) … … 136 167 return RedirectToAction("NotExist", "Error"); 137 168 } 138 Pet_CaresClass peClass = db.PetCaresObj.Find(id); 169 170 Pet_CaresClass peClass = await db.PetCaresObj.FindAsync(id); 139 171 if (peClass == null) 140 172 { 141 173 return RedirectToAction("NotExist", "Error"); 142 174 } 143 return View(peClass); 144 } 175 176 var vetCenters = await db.VetCentersObj.ToListAsync(); 177 ViewBag.VetCenters = new SelectList(vetCenters, "id", "name", peClass.vetcentersid); 178 179 return View(peClass); 180 } 181 182 145 183 146 184 // POST: Customer/Edit/5 … … 149 187 [HttpPost] 150 188 [ValidateAntiForgeryToken] 151 public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, start_datevetcentersid")] Pet_CaresClass peClass)189 public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, vetcentersid")] Pet_CaresClass peClass) 152 190 { 153 191 bool isAuthenticated = User.Identity.IsAuthenticated; … … 156 194 return RedirectToAction("AccessDenied", "Error"); 157 195 } 158 196 159 197 if (ModelState.IsValid) 160 198 { 161 199 peClass.dateending = DateTime.SpecifyKind(peClass.dateending, DateTimeKind.Utc); 162 peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc);163 200 var user = await _userManager.GetUserAsync(User); 164 201 var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email); … … 171 208 } 172 209 210 211 212 173 213 // GET: Customer/Delete/5 174 214 public ActionResult Delete(int? id) -
PostgreSqlDotnetCore/Controllers/PetsController.cs
rae6c071 r8f8226c 73 73 [HttpPost] 74 74 [ValidateAntiForgeryToken] 75 public async Task<ActionResult> CreateAsync([Bind(include: "id, color,description,dateofbirthday, usersid,typeofpetsid")] PetsClass peClass)75 public async Task<ActionResult> CreateAsync([Bind(include: "id,name,color,description,dateofbirthday, usersid,typeofpetsid")] PetsClass peClass) 76 76 { 77 77 bool isAuthenticated = User.Identity.IsAuthenticated; … … 116 116 [HttpPost] 117 117 [ValidateAntiForgeryToken] 118 public async Task<ActionResult> EditAsync([Bind(include: "id, color,description,dateofbirthday, usersid,typeofpetsid")] PetsClass peClass)118 public async Task<ActionResult> EditAsync([Bind(include: "id,name, color,description,dateofbirthday, usersid,typeofpetsid")] PetsClass peClass) 119 119 { 120 120 bool isAuthenticated = User.Identity.IsAuthenticated; -
PostgreSqlDotnetCore/Models/BlogPostAnswers.cs
rae6c071 r8f8226c 12 12 public int parent_id { get; set; } 13 13 public string reply { get; set; } 14 public int? blogpostconsultationid { get; set; } 14 15 [ForeignKey("BlogPostConsultation")] 16 [Column("blogpostconsid")] 17 public int BlogPostConsultationid { get; set; } 18 public BlogPostConsultation BlogPostConsultation { get; set; } 19 15 20 public int usersid { get; set; } 16 21 } -
PostgreSqlDotnetCore/Models/PetsClass.cs
rae6c071 r8f8226c 16 16 public string color { get; set; } 17 17 18 public string name { get; set; } 19 18 20 public string description { get; set; } 19 21 // public DateTime dateofbirthday { get; set; } -
PostgreSqlDotnetCore/Views/PetCares/Edit.cshtml
rae6c071 r8f8226c 48 48 </div> 49 49 50 <div class="form-group"> 50 <div class="form-group"> 51 @Html.LabelFor(model => model.vetcentersid, htmlAttributes: new { @class = "control-label col-md-2" }) 52 <div class="col-md-10"> 53 @Html.DropDownListFor(model => model.vetcentersid, (SelectList)ViewBag.VetCenters, "Select VetCenter", new { @class = "form-control" }) 54 @Html.ValidationMessageFor(model => model.vetcentersid, "", new { @class = "text-danger" }) 55 </div> 56 </div> 57 58 59 @*<div class="form-group"> 51 60 @Html.LabelFor(model => model.vetcentersid, htmlAttributes: new { @class = "control-label col-md-2" }) 52 61 <div class="col-md-10"> … … 55 64 </div> 56 65 </div> 66 *@ 67 @* 68 <div class="form-group"> 69 <label class="control-label col-md-2" for="vetcentersid">VetCenter:</label> 70 <div class="col-md-10"> 71 @Html.DropDownList("vetcentersid", (SelectList)ViewBag.VetCenters, "Select VetCenter", new { @class = "form-control" }) 72 </div> 73 </div> 74 *@ 57 75 58 76 -
PostgreSqlDotnetCore/Views/Pets/Create.cshtml
rae6c071 r8f8226c 16 16 <hr /> 17 17 @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 19 <div class="form-group"> 20 @Html.LabelFor(model => model.name, htmlAttributes: new { @class = "control-label col-md-2" }) 21 <div class="col-md-10"> 22 @Html.EditorFor(model => model.name, new { htmlAttributes = new { @class = "form-control" } }) 23 @Html.ValidationMessageFor(model => model.name, "", new { @class = "text-danger" }) 24 </div> 25 </div> 18 26 19 27 <div class="form-group"> -
PostgreSqlDotnetCore/Views/Pets/Delete.cshtml
rae6c071 r8f8226c 12 12 <hr /> 13 13 <dl class="dl-horizontal"> 14 15 <dt> 16 @Html.DisplayNameFor(model => model.name) 17 </dt> 18 19 <dd> 20 @Html.DisplayFor(model => model.name) 21 </dd> 14 22 <dt> 15 23 @Html.DisplayNameFor(model => model.color) -
PostgreSqlDotnetCore/Views/Pets/Details.cshtml
rae6c071 r8f8226c 11 11 <hr /> 12 12 <dl class="dl-horizontal"> 13 <dt> 14 @Html.DisplayNameFor(model => model.name) 15 </dt> 16 17 <dd> 18 @Html.DisplayFor(model => model.name) 19 </dd> 13 20 <dt> 14 21 @Html.DisplayNameFor(model => model.color) -
PostgreSqlDotnetCore/Views/Pets/Edit.cshtml
rae6c071 r8f8226c 18 18 @Html.HiddenFor(model => model.id) 19 19 20 <div class="form-group"> 21 @Html.LabelFor(model => model.name, htmlAttributes: new { @class = "control-label col-md-2" }) 22 <div class="col-md-10"> 23 @Html.EditorFor(model => model.name, new { htmlAttributes = new { @class = "form-control" } }) 24 @Html.ValidationMessageFor(model => model.name, "", new { @class = "text-danger" }) 25 </div> 26 </div> 20 27 <div class="form-group"> 21 28 @Html.LabelFor(model => model.color, htmlAttributes: new { @class = "control-label col-md-2" }) -
PostgreSqlDotnetCore/Views/Pets/Index.cshtml
rae6c071 r8f8226c 12 12 <table class="table"> 13 13 <tr> 14 <th> 15 @Html.DisplayNameFor(model => model.name) 16 </th> 14 17 15 18 <th> … … 36 39 @foreach (var item in Model) { 37 40 <tr> 41 <td> 42 @Html.DisplayFor(modelItem => item.name) 43 </td> 38 44 <td> 39 45 @Html.DisplayFor(modelItem => item.color)
Note:
See TracChangeset
for help on using the changeset viewer.