Changeset ae6c071
- Timestamp:
- 08/15/24 20:01:13 (3 months ago)
- Branches:
- main
- Children:
- 8f8226c
- Parents:
- 2639fab
- Location:
- PostgreSqlDotnetCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
PostgreSqlDotnetCore/Controllers/PetCaresController.cs
r2639fab rae6c071 2 2 using Microsoft.AspNetCore.Mvc; 3 3 using Microsoft.EntityFrameworkCore; 4 using Microsoft.AspNetCore.Mvc.Rendering; 4 5 using PostgreSqlDotnetCore.Models; 5 6 using System; … … 14 15 } 15 16 17 18 [HttpGet] 19 public async Task<ActionResult> Create() 20 { 21 22 var vetCenters = await db.VetCentersObj.ToListAsync(); 23 24 ViewBag.VetCenters = new SelectList(vetCenters, "id", "name"); 25 26 return View(); 27 } 28 16 29 // GET: Customer 17 30 public async Task<ActionResult> IndexAsync() … … 83 96 //} 84 97 85 public ActionResult Create()98 /*public ActionResult Create() 86 99 { 87 100 88 101 return View(); 89 } 102 }*/ 90 103 91 104 // POST: Customer/Create … … 94 107 [HttpPost] 95 108 [ValidateAntiForgeryToken] 96 public async Task<ActionResult> CreateAsync([Bind(include: "id,title,description,dateending, usersid, vetcentersid")] Pet_CaresClass peClass)109 public async Task<ActionResult> CreateAsync([Bind(include: "id,title,description,dateending, start_date, usersid, vetcentersid")] Pet_CaresClass peClass) 97 110 { 98 111 bool isAuthenticated = User.Identity.IsAuthenticated; … … 104 117 { 105 118 peClass.dateending = DateTime.SpecifyKind(peClass.dateending, DateTimeKind.Utc); 119 peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc); 106 120 var user = await _userManager.GetUserAsync(User); 107 121 var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email); … … 135 149 [HttpPost] 136 150 [ValidateAntiForgeryToken] 137 public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, vetcentersid")] Pet_CaresClass peClass)151 public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, start_date vetcentersid")] Pet_CaresClass peClass) 138 152 { 139 153 bool isAuthenticated = User.Identity.IsAuthenticated; … … 146 160 { 147 161 peClass.dateending = DateTime.SpecifyKind(peClass.dateending, DateTimeKind.Utc); 162 peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc); 148 163 var user = await _userManager.GetUserAsync(User); 149 164 var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email); -
PostgreSqlDotnetCore/Models/Pet_CaresClass.cs
r2639fab rae6c071 19 19 public string description { get; set; } 20 20 public DateTime dateending { get; set; } 21 22 public DateTime start_date { get; set; } 23 24 public void SetDatesToUtc() 25 { 26 dateending = DateTime.SpecifyKind(dateending, DateTimeKind.Utc); 27 start_date = DateTime.SpecifyKind(start_date, DateTimeKind.Utc); 28 } 21 29 public int usersid { get; set; } 22 30 public int vetcentersid { get; set; } -
PostgreSqlDotnetCore/Views/PetCares/Create.cshtml
r2639fab rae6c071 37 37 </div> 38 38 </div> 39 <div class="form-group"> 40 @Html.LabelFor(model => model.start_date, htmlAttributes: new { @class = "control-label col-md-2" }) 41 <div class="col-md-10"> 42 @Html.EditorFor(model => model.start_date, new { htmlAttributes = new { @class = "form-control" } }) 43 @Html.ValidationMessageFor(model => model.start_date, "", new { @class = "text-danger" }) 44 </div> 45 </div> 39 46 40 47 … … 46 53 </div> 47 54 </div> *@ 55 @* 48 56 <div class="form-group"> 49 57 <label class="control-label col-md-2" for="vetcentersid">VetCenter:</label> … … 51 59 <select class="form-control" id="vetcentersid" name="vetcentersid"> 52 60 <option value="">Select VetCenter</option> 53 <option value=" 1">Vet Svet</option>54 <option value=" 2">Veterinarian Ambulance - Dr.Tonit</option>55 <option value=" 4">Vet In</option>61 <option value="4">Vet Svet</option> 62 <option value="5">Veterinarian Ambulance - Dr.Tonit</option> 63 <option value="6">Vet In</option> 56 64 </select> 57 65 </div> 58 66 </div> 67 *@ 59 68 69 <div class="form-group"> 70 <label class="control-label col-md-2" for="vetcentersid">VetCenter:</label> 71 <div class="col-md-10"> 72 @Html.DropDownList("vetcentersid", (SelectList)ViewBag.VetCenters, "Select VetCenter", new { @class = "form-control" }) 73 </div> 74 </div> 60 75 61 76 -
PostgreSqlDotnetCore/Views/PetCares/Delete.cshtml
r2639fab rae6c071 22 22 </dt> 23 23 <dt> 24 @Html.DisplayNameFor(model => model.start_date) 25 </dt> 26 <dt> 24 27 @Html.DisplayNameFor(model => model.usersid) 25 28 </dt> … … 37 40 <dd> 38 41 @Html.DisplayFor(model => model.dateending) 42 </dd> 43 <dd> 44 @Html.DisplayFor(model => model.start_date) 39 45 </dd> 40 46 <dd> -
PostgreSqlDotnetCore/Views/PetCares/Details.cshtml
r2639fab rae6c071 33 33 </dd> 34 34 <dt> 35 @Html.DisplayNameFor(model => model.start_date) 36 </dt> 37 38 <dd> 39 @Html.DisplayFor(model => model.start_date) 40 </dd> 41 <dt> 35 42 @Html.DisplayNameFor(model => model.usersid) 36 43 </dt> -
PostgreSqlDotnetCore/Views/PetCares/Edit.cshtml
r2639fab rae6c071 40 40 </div> 41 41 </div> 42 <div class="form-group"> 43 @Html.LabelFor(model => model.start_date, htmlAttributes: new { @class = "control-label col-md-2" }) 44 <div class="col-md-10"> 45 @Html.EditorFor(model => model.start_date, new { htmlAttributes = new { @class = "form-control" } }) 46 @Html.ValidationMessageFor(model => model.start_date, "", new { @class = "text-danger" }) 47 </div> 48 </div> 42 49 43 50 <div class="form-group"> -
PostgreSqlDotnetCore/Views/PetCares/Index.cshtml
r2639fab rae6c071 23 23 </th> 24 24 <th> 25 @Html.DisplayNameFor(model => model.start_date) 26 </th> 27 <th> 25 28 @Html.DisplayNameFor(model => model.usersid) 26 29 </th> … … 44 47 @Html.DisplayFor(modelItem => item.dateending) 45 48 </td> 49 <td> 50 @Html.DisplayFor(modelItem => item.start_date) 51 </td> 46 52 <td> 47 53 @Html.DisplayFor(modelItem => item.usersid)
Note:
See TracChangeset
for help on using the changeset viewer.