Changeset ae6c071


Ignore:
Timestamp:
08/15/24 20:01:13 (3 months ago)
Author:
ElenaMoskova <elena.moskova99@…>
Branches:
main
Children:
8f8226c
Parents:
2639fab
Message:

Аutomating the process

automating the process of updating the list of veterinary centers

Location:
PostgreSqlDotnetCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • PostgreSqlDotnetCore/Controllers/PetCaresController.cs

    r2639fab rae6c071  
    22using Microsoft.AspNetCore.Mvc;
    33using Microsoft.EntityFrameworkCore;
     4using Microsoft.AspNetCore.Mvc.Rendering;
    45using PostgreSqlDotnetCore.Models;
    56using System;
     
    1415        }
    1516
     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
    1629        // GET: Customer
    1730        public async Task<ActionResult> IndexAsync()
     
    8396        //}
    8497
    85         public ActionResult Create()
     98        /*public ActionResult Create()
    8699        {
    87100           
    88101            return View();
    89         }
     102        }*/
    90103
    91104        // POST: Customer/Create
     
    94107        [HttpPost]
    95108        [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)
    97110        {
    98111            bool isAuthenticated = User.Identity.IsAuthenticated;
     
    104117            {
    105118                peClass.dateending = DateTime.SpecifyKind(peClass.dateending, DateTimeKind.Utc);
     119                peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc);
    106120                var user = await _userManager.GetUserAsync(User);
    107121                var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);
     
    135149        [HttpPost]
    136150        [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)
    138152        {
    139153            bool isAuthenticated = User.Identity.IsAuthenticated;
     
    146160            {
    147161                peClass.dateending = DateTime.SpecifyKind(peClass.dateending, DateTimeKind.Utc);
     162                peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc);
    148163                var user = await _userManager.GetUserAsync(User);
    149164                var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);
  • PostgreSqlDotnetCore/Models/Pet_CaresClass.cs

    r2639fab rae6c071  
    1919        public string description { get; set; }
    2020        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        }
    2129        public int usersid { get; set; }
    2230        public int vetcentersid { get; set; }
  • PostgreSqlDotnetCore/Views/PetCares/Create.cshtml

    r2639fab rae6c071  
    3737        </div>
    3838    </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>
    3946
    4047
     
    4653        </div>
    4754    </div> *@
     55    @*
    4856        <div class="form-group">
    4957            <label class="control-label col-md-2" for="vetcentersid">VetCenter:</label>
     
    5159                <select class="form-control" id="vetcentersid" name="vetcentersid">
    5260                    <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>
    5664                </select>
    5765            </div>
    5866        </div>
     67        *@
    5968
     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>
    6075
    6176
  • PostgreSqlDotnetCore/Views/PetCares/Delete.cshtml

    r2639fab rae6c071  
    2222        </dt>
    2323        <dt>
     24            @Html.DisplayNameFor(model => model.start_date)
     25        </dt>
     26        <dt>
    2427            @Html.DisplayNameFor(model => model.usersid)
    2528        </dt>
     
    3740        <dd>
    3841            @Html.DisplayFor(model => model.dateending)
     42        </dd>
     43        <dd>
     44            @Html.DisplayFor(model => model.start_date)
    3945        </dd>
    4046        <dd>
  • PostgreSqlDotnetCore/Views/PetCares/Details.cshtml

    r2639fab rae6c071  
    3333        </dd>
    3434        <dt>
     35            @Html.DisplayNameFor(model => model.start_date)
     36        </dt>
     37
     38        <dd>
     39            @Html.DisplayFor(model => model.start_date)
     40        </dd>
     41        <dt>
    3542            @Html.DisplayNameFor(model => model.usersid)
    3643        </dt>
  • PostgreSqlDotnetCore/Views/PetCares/Edit.cshtml

    r2639fab rae6c071  
    4040        </div>
    4141    </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>
    4249
    4350    <div class="form-group">
  • PostgreSqlDotnetCore/Views/PetCares/Index.cshtml

    r2639fab rae6c071  
    2323        </th>
    2424        <th>
     25            @Html.DisplayNameFor(model => model.start_date)
     26        </th>
     27        <th>
    2528            @Html.DisplayNameFor(model => model.usersid)
    2629        </th>
     
    4447            @Html.DisplayFor(modelItem => item.dateending)
    4548        </td>
     49            <td>
     50                @Html.DisplayFor(modelItem => item.start_date)
     51            </td>
    4652        <td>
    4753            @Html.DisplayFor(modelItem => item.usersid)
Note: See TracChangeset for help on using the changeset viewer.