Commit a98768ba authored by hasan khaddour's avatar hasan khaddour

fix s

parent f402feed
......@@ -21,7 +21,7 @@ namespace WebPresentation.Controllers
protected readonly IMapper _mapper;
protected readonly IService<TDto> _service;
private Func<TDto, bool> _criteriaProtected;
protected Func<TDto, bool> _criteria {
protected Func<TDto, bool> criteria {
get {
if (_criteriaProtected == null) {
_criteriaProtected = GetCriteria();
......@@ -77,7 +77,7 @@ namespace WebPresentation.Controllers
TDto DetailDto = await _service.GetDetails((int)id);
if (DetailDto is null)
return View("NotFound");
if (_criteria(DetailDto))
if (criteria(DetailDto))
{
TVModel model = _mapper.Map<TVModel>(DetailDto);
return View(model);
......@@ -92,7 +92,7 @@ namespace WebPresentation.Controllers
TDto DetailDto = await _service.GetDetails(id);
if (DetailDto == null || !_criteria(DetailDto))
if (DetailDto == null || !criteria(DetailDto))
{
return PartialView("PartialNotFound");
}
......@@ -105,7 +105,7 @@ namespace WebPresentation.Controllers
{
TDto DetailDto = await _service.GetDetails(id);
if (DetailDto == null || !_criteria(DetailDto))
if (DetailDto == null || !criteria(DetailDto))
{
return PartialView("PartialNotFound");
}
......@@ -125,7 +125,7 @@ namespace WebPresentation.Controllers
{
TDto tModel = await _service.GetDetails((int)id);
if (tModel == null || !_criteria(tModel))
if (tModel == null || !criteria(tModel))
{
return PartialView("PartialNotFound");
}
......@@ -149,13 +149,20 @@ namespace WebPresentation.Controllers
return PartialView("PartialNotFound");
}
TDto dto ;
if (ModelState.IsValid)
{
try
{
dto = _mapper.Map<TDto>(viewModel);
if (dto == null || !criteria(dto))
{
return PartialView("PartialNotFound");
}
dto = _service.Update(dto);
}
......@@ -184,7 +191,7 @@ namespace WebPresentation.Controllers
{
TDto dto = _mapper.Map<TDto>(viewModel);
if (viewModel == null || !_criteria(dto))
if (viewModel == null || !criteria(dto))
{
return PartialView(viewModel);
}
......@@ -211,7 +218,7 @@ namespace WebPresentation.Controllers
else
{
TDto model = await _service.GetDetails((int)id);
if (model is null || !_criteria(model))
if (model is null || !criteria(model))
return Ok(new { message = "No Data Found ", result = "Faild" });
return Ok(new { message = "Succed", result = model });
......
......@@ -59,7 +59,7 @@ namespace WebPresentation.Controllers
[HttpPost]
[ValidateAntiForgeryToken]
[ImageLoadFilter]
public async Task<IActionResult> Edit(int id, [FromForm] PatientViewModel viewModel)
public IActionResult Edit(int id, [FromForm] PatientViewModel viewModel)
{
if (id != viewModel.Id)
{
......@@ -99,7 +99,7 @@ namespace WebPresentation.Controllers
}
[Authorize(Roles = "patient")]
public async Task<IActionResult> Details(int? id ) {
public async Task<IActionResult> Details() {
var t = await getCurrentPatient();
return View(t);
......
......@@ -75,7 +75,7 @@ namespace WebPresentation.Controllers
try
{
var medical = await _medicalStateService.GetDetails(medicalStateMedicine.MedicalStateId);
if(!_criteria(medical))
if(!criteria(medical))
return Ok(new { message = "You try to add a medicine for other patient and this is wrong , you shouldn't add a medicine for others", result = "faild" });
var medicalStateMedicineModel = _mapper.Map<MedicalStateMedicineDTO>(medicalStateMedicine);
......@@ -103,7 +103,7 @@ namespace WebPresentation.Controllers
try
{
var medical = await _medicalStateService.GetDetails(medicalStateMedicine.MedicalStateId);
if (!_criteria(medical))
if (!criteria(medical))
return Ok(new { message = "You try to Reomve a medicine for other patient and this is wrong , you shouldn't remove a medicine for others maybe this kill him", result = "faild" });
_medicineService.RemoveFromMedicalState(medicalStateMedicineModel);
......@@ -152,8 +152,7 @@ namespace WebPresentation.Controllers
{
var u = _patientService.GetByUserId(GetUserId()).Result.Id;
_criteria = p => p.PatientId == u;
return _criteria;
return p => p.PatientId == u; ;
}
}
......
......@@ -38,7 +38,7 @@ namespace WebPresentation.Controllers
{
await _ingredientService.RemoveFromMedicine(medicineIngredientModel);
return Ok(new { message = "The Ingredient Removed Successfully", result = "add" });
return Ok(new { message = "add" , result = "The Ingredient Removed Successfully" });
}
catch (DomainException e)
{
......@@ -53,7 +53,7 @@ namespace WebPresentation.Controllers
try
{
await _ingredientService.AddToMedicine(medicineIngredientModel);
return Ok(new { message = "The Ingredient Added Successfully", result = "add" });
return Ok(new { message = "add" , result = "The Ingredient Added Successfully" });
}
catch (DomainException e ) {
......
using Microsoft.AspNetCore.Http;
using ApplicationDomain.Exceptions;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -23,6 +24,12 @@ namespace WebPresentation.Midlewares
{
await _next(httpContext);
}
catch (DomainException ex)
{
httpContext.Response.Redirect("/Home/Error");
}
catch (Exception ex)
{
......@@ -32,7 +39,8 @@ namespace WebPresentation.Midlewares
private static Task HandleExceptionAsync(HttpContext context, Exception exception)
{
context.Response.Redirect("/Home/Error");
//log it then redirect
context.Response.Redirect("/Home/Error");
return Task.CompletedTask;
}
......
......@@ -17,6 +17,7 @@ using ApplicationDomain.Abstraction;
using ApplicationDomain.Repositories;
using ApplicationCore.DTOs;
using ApplicationCore.Mapper;
using WebPresentation.Midlewares;
using System;
using Microsoft.AspNetCore.Http;
using ApplicationCore.Mappere;
......@@ -165,11 +166,13 @@ namespace WebPresentation
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseMiddleware<ExceptionHandler>();
// app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
// app.UseStatusCodePagesWithRedirects();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
......
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -8,6 +9,8 @@ namespace WebPresentation.ViewModels
{
public class IngredientViewModel : BaseViewModel
{
[Required]
[MinLength(4)]
public String Name { get; set; }
public String Description { get; set; }
......
......@@ -7,13 +7,19 @@ namespace WebPresentation.ViewModels
{
public class MedicineViewModel : BaseViewModel , IImageForm
{
[Required]
[Display(Name ="Trade Name ")]
public String TradeName { get; set; }
[Required]
[Display(Name = "Scintific Name ")]
public String ScintificName { get; set; }
[Required]
[Display(Name = "Manufacture Name ")]
public String ManufactureName { get; set; }
[Required]
[Display(Name = "Side Effect")]
public String SideEffect { get; set; }
public String Description { get; set; }
......
@model WebPresentation.ViewModels.ChangePasswordViewModel
<section class="page-section py-5">
<form asp-action="ChangePassword" method="post">
<div class="form-group">
<label asp-for="CurrentPassword"></label>
<input asp-for="CurrentPassword" class="form-control" />
<span asp-validation-for="CurrentPassword" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="NewPassword"></label>
<input asp-for="NewPassword" class="form-control" />
<span asp-validation-for="NewPassword" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="ConfirmPassword"></label>
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
<style>
.separator {
border-right: 1px solid #dfdfe0;
}
.icon-btn-save {
padding-top: 0;
padding-bottom: 0;
}
.input-group {
margin-bottom: 10px;
}
.btn-save-label {
position: relative;
left: -12px;
display: inline-block;
padding: 6px 12px;
background: rgba(0,0,0,0.15);
border-radius: 3px 0 0 3px;
}
</style>
<section class="page-section ">
<form asp-action="ChangePassword" class=py-5 method="post">
<div class="container bootstrap snippets bootdey">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-md-offset-2">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-th"></span>
Change password
</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 separator social-login-box">
<br>
<img alt="" class="img-thumbnail" src="/img/portfolio/Denide.png">
</div>
<div style="margin-top:80px;" class="col-xs-6 col-sm-6 col-md-6 login-box">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-lock"></span>
</div>
<input asp-for="CurrentPassword" class="form-control" type="password" placeholder="Current Password">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-log-in"></span></div>
<input asp-for="NewPassword" class="form-control" type="password" placeholder="New Password">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-log-in"></span></div>
<input asp-for="ConfirmPassword" class="form-control" type="password" placeholder="New Password">
</div>
</div>
</div>
</div>
</div>
<div class="panel-footer">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6"></div>
<div class="col-xs-6 col-sm-6 col-md-6">
<button class="btn icon-btn-save btn-success" type="submit">
<span class="btn-save-label"><i class="glyphicon glyphicon-floppy-disk"></i></span>save
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary">Change Password</button>
</form>
</section>
</div>
</form>
</section>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
......@@ -7,7 +7,7 @@
ViewData["userName"] = Model.User.FirstName + " " + Model.User.LastName;
ViewData["title"] = "Edit";
ViewData["title"] = "Details";
ViewBag.Avatar = Model.User.Avatar;
ViewData["Controller"] = "Home";
......
......@@ -4,55 +4,142 @@
ViewData["Title"] = "Edit";
}
<style>
.account-settings .user-profile {
margin: 0 0 1rem 0;
padding-bottom: 1rem;
text-align: center;
}
<section class="page-section">
<div class="container py-5">
<div class="row justify-content-center">
<div class="">
<div class="card shadow-sm">
<div class="card-body">
<form asp-action="Edit" class="row g-3" enctype="multipart/form-data">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="col-md-6">
<label asp-for="BIO" class="form-label">Patient Personal info</label>
<input asp-for="BIO" class="form-control" />
<span asp-validation-for="BIO" class="text-danger"></span>
</div>
.account-settings .user-profile .user-avatar {
margin: 0 0 1rem 0;
}
<div class="col-md-6">
<label asp-for="User.FirstName" class="form-label"></label>
<input asp-for="User.FirstName" class="form-control" />
<span asp-validation-for="User.FirstName" class="text-danger"></span>
</div>
.account-settings .user-profile .user-avatar img {
width: 90px;
height: 90px;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
}
.account-settings .user-profile h5.user-name {
margin: 0 0 0.5rem 0;
}
<div class="col-md-6">
<label asp-for="User.LastName" class="form-label"></label>
<input asp-for="User.LastName" class="form-control" />
<span asp-validation-for="User.LastName" class="text-danger"></span>
</div>
.account-settings .user-profile h6.user-email {
margin: 0;
font-size: 0.8rem;
font-weight: 400;
}
.account-settings .about {
margin: 1rem 0 0 0;
font-size: 0.8rem;
text-align: center;
}
.card {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border: 0;
margin-bottom: 1rem;
}
<div class="col-12">
<label asp-for="ImageFile" class="form-label">Image File</label>
<input type="file" asp-for="ImageFile" class="form-control" />
<span asp-validation-for="ImageFile" class="text-danger"></span>
.form-control {
border: 1px solid #596280;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
font-size: .825rem;
}
</style>
<section class="page-section ">
<form asp-action="Edit" enctype="multipart/form-data">
<div class="container">
<div asp-validation-summary="ModelOnly" class="row gutters border-1">
<div class="col-xl-3 col-lg-3 col-md-12 col-sm-12 col-12">
<div class="card h-100">
<div class="card-body">
<div class="account-settings">
<div class="user-profile">
<div class="user-avatar">
<img src="/img/@Model.User.Avatar" alt="@Model.User.FirstName">
</div>
<h5 class="user-name">@Model.User.FirstName @Model.User.LastName </h5>
<h6 class="user-email">@Model.User.Email </h6>
</div>
<div class="about">
<h5 class="mb-2 text-primary">About</h5>
<p>@Model.BIO</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-9 col-lg-9 col-md-12 col-sm-12 col-12">
<div class="card h-100">
<div class="card-body">
<div class="row gutters">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<h6 class="mb-3 text-primary">Personal Details</h6>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12">
<div class="form-group">
<label asp-for="User.FirstName" class="form-label"></label>
<input asp-for="User.FirstName" class="form-control" />
<span asp-validation-for="User.FirstName" class="text-danger"></span>
<div class="col-12 mt-4">
<input type="hidden" asp-for="Id" />
<input type="hidden" asp-for="User.Id" />
<input type="hidden" asp-for="UserId" />
<button type="submit" class="btn btn-primary">Save</button>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12">
<div class="form-group">
<label asp-for="User.LastName" class="form-label"></label>
<input placeholder="@Model.User.LastName" asp-for="User.LastName" class="form-control" />
<span asp-validation-for="User.LastName" class="text-danger"></span>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12">
<div class="form-group">
<label asp-for="User.PhoneNumber" class="form-label"></label>
<input asp-for="User.PhoneNumber" class="form-control" />
<span asp-validation-for="User.PhoneNumber" class="text-danger"></span>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12">
<div class="">
<label asp-for="ImageFile" class="form-label"></label>
<input asp-for="ImageFile" class="form-control" />
</div>
</div>
</div>
<div class="row gutters">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<h6 class="mb-3 text-primary">More Info</h6>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12">
<div class="form-group">
<label asp-for="BIO" class="form-label"></label>
<textarea asp-for="BIO" rows="4" class="form-control " ></textarea>
</div>
</div>
</div>
</form>
<div class="row gutters">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<div class="text-right">
<a type="button" asp-action="Index" asp-controller="Home" class="btn btn-secondary">Cancel</a>
<button type="button" id="submit" name="submit" class="btn btn-primary">Update</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</section>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
......
......@@ -15,10 +15,10 @@
</div>
<div class="modal-body">
<div class="container py-5">
<div class="container ">
<div class="row justify-content-center">
<div class="col ">
<div class=" shadow-lg p-3 mb-5 bg-white rounded">
<div class=" p-3 bg-white rounded">
<div class="">
<hr />
<form asp-action="Create" method="post">
......@@ -37,14 +37,13 @@
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary btn-lg">Create</button>
<button type="submit" class="btn btn-primary mr-4 btn">Create</button>
<button type="button" class="btn btn-secondary ml-4" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
<div class="text-center">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
......
......@@ -56,7 +56,7 @@
<div class="d-flex">
<button class="btn btn-warning btn-edit m-1" data-id="@item.Id">Edit</button>
<button class="btn btn-danger btn-delete m-1" data-id="@item.Id">Delete</button>
<a asp-action="Details" asp-route-id="@item.Id" class="m-1 btn btn-info text-info " title="Details">Details</a>
<a asp-action="Details" asp-route-id="@item.Id" class="m-1 btn btn-info " >Details</a>
</div>
</td>
</tr>
......
......@@ -51,6 +51,7 @@
<h5>Your Medicines in this case:</h5>
<hr class="mt-0 ">
<div class="row p-4">
<div class="table-responsive">
<table id="Ingredients_" class="table table-bordered table-hover">
<thead class="thead-light">
<tr>
......@@ -94,6 +95,8 @@
}
</tbody>
</table>
</div>
</div>
<hr />
<div class="row pt-1">
......
......@@ -8,8 +8,9 @@
<div class="container mt-5">
<div class="row mb-4">
<div class="col text-center">
do you have a new Medical case ?
<button class="btn btn-success ml-2 btn-create" >Create</button>
<h4>
do you have a new Medical case ?
</h4> <button class="btn btn-success ml-2 btn-create" data-controller="MedicalState">Create</button>
</div>
</div>
......
......@@ -23,22 +23,22 @@
<button class="btn btn-danger btn-delete" data-id="@Model.Id">Delete</button>
</div>
<div class="col-8">
<div class="card-body p-4">
<h6>Information:</h6>
<div class=" p-4">
<h6 class="text-center">Information</h6>
<hr class="mt-0 mb-4">
<div class="row pt-1">
<div class="col mb-3">
<div class="col-12 mb-3">
<h6>
Description : <span class="text-muted">@Model.Description</span>
</h6>
</div>
<div class="col-12 row mb-3">
<h6 class="col">
<h6 class="col-6">
Type : <span class="text-muted">@Model.MedicineType?.TypeName</span>
</h6>
<h6 class="col text-muted">Dosage : <span class="text-muted">@Model.Dosage</span></h6>
<h6 class="col text-muted">Price : <span class="text-muted">@Model.Price</span></h6>
<h6 class="col-6">Dosage : <span class="text-muted">@Model.Dosage</span></h6>
<h6 class="col-6">Price : <span class="text-muted">@Model.Price</span></h6>
</div>
</div>
......@@ -46,55 +46,58 @@
</div>
<div class="col-12 p-3">
<h6>Ingredients : </h6>
<hr class="mt-0 mb-4">
<h6 class="text-center">Ingredients </h6>
<hr class="">
<div class="row pt-1 p-3">
<table id="Ingredients_" class=" p-4 table table-bordered">
<thead class="thead-light">
<tr>
<td>#</td>
<td>Name</td>
<td>Description</td>
<td>Ratio</td>
<td>Manage</td>
</tr>
</thead>
<tbody>
@if (Model.MedicineIngredients.Count == 0)
{
<div class="table-responsive">
<table id="Ingredients_" class="table table-bordered">
<thead>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>#</td>
<td>Name</td>
<td>Description</td>
<td>Ratio</td>
<td>Manage</td>
</tr>
</thead>
<tbody>
@if (Model.MedicineIngredients.Count == 0)
{
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
}
@foreach (var ing in Model.MedicineIngredients)
{
<tr class=" mb-3">
<td>@(a+=1)</td>
<td>@ing.Ingredient.Name</td>
<td>@ing.Ingredient.Description</td>
<td>@ing.Ratio</td>
<td>
<button class="btn btn-danger" ondblclick='DeleteConfirm("Delete Confirm", "Are you sure you want to delete @ing.Ingredient.Name From this medicine", "ReomveIngredient",@ing.IngredientId)'>Delete</button>
</td>
}
@foreach (var ing in Model.MedicineIngredients)
{
<tr class=" mb-3">
<td>@(a+=1)</td>
<td>@ing.Ingredient.Name</td>
<td>@ing.Ingredient.Description</td>
<td>@ing.Ratio</td>
<td>
<button class="btn btn-danger" ondblclick='DeleteConfirm("Delete Confirm", "Are you sure you want to delete @ing.Ingredient.Name From this medicine", "ReomveIngredient",@ing.IngredientId)'>Delete</button>
</td>
</tr>
}
</tbody>
</table>
</tr>
}
</tbody>
</table>
</div>
</div>
<hr />
<div class="row pt-1">
<div class="col-6 mb-3">
<a asp-action="Index">Back to List</a>
<div class="col-4 offset-1 mb-3">
<a class="btn btn-primary" asp-action="Index">Back to List</a>
</div>
<div class="col-6 mb-3">
<div class="col-4 mb-3">
<button class="btn btn-primary" onclick="fetchAll()">Get All Ingredients </button>
</div>
......@@ -215,7 +218,7 @@
row.innerHTML = `
<td>${medicine.ingredient.name}</td>
<td>${medicine.ingredient.description}</td>
${ medicine.ratio}
<td>${ medicine.ratio}</td>
<td>
<button
......@@ -284,7 +287,7 @@
if (response.ok) {
let result = await response.json();
updateIngredients();
showToast(result.message, result.result);
showToast(result.result, result.message);
} else {
console.error('Error:', response.statusText);
showToast('Failed to add medicine', 'Error');
......@@ -334,8 +337,9 @@
if (response.ok) {
let result = await response.json();
showToast(result.message, result.result);
updateIngredients();
showToast(result.result, result.message);
} else {
......
@{
@Model String
@{
ViewData["Title"] = "Error";
var c = "An error occurred while processing your request.";
if (! (Model== "" || Model is null )) {
c = Model;
}
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
<h2 class="text-danger">@c</h2>
......@@ -12,15 +12,15 @@
<meta name="description" content="" />
<meta name="author" content="" />
<title>DashBoard - @ViewData["Title"]</title>
@*<link href="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/style.min.css" rel="stylesheet" />*@
<link href="/css/styles.css" rel="stylesheet" />
<link href="/favicon.png" rel="icon">
@* <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>*@
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<!-- Custom fonts for this theme -->
<link href="~/fonts/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
<link href="~/favicon.png" rel="icon" />
<!-- Theme CSS -->
<link href="~/css/freelancer.css" rel="stylesheet">
......@@ -81,6 +81,7 @@
</a>
<div class="collapse" id="collapseLayouts" aria-labelledby="headingOne" data-bs-parent="#sidenavAccordion">
<nav class="sb-sidenav-menu-nested nav">
<a class="nav-link btn-create" data-Controller="Patients">Add Patient </a>
<a class="nav-link" asp-controller="Patients" asp-action="Index">ALL Patients </a>
</nav>
......@@ -94,8 +95,9 @@
</a>
<div class="collapse" id="ing" aria-labelledby="headingOne" data-bs-parent="#sidenavAccordion">
<nav class="sb-sidenav-menu-nested nav">
<a class="nav-link" asp-controller="Ingredient" asp-action="Create">Add Ingredient </a>
<a class="nav-link btn-create" data-Controller="Ingredient" >Add Ingredient </a>
<a class="nav-link" asp-controller="Ingredient" asp-action="Index">ALL Ingredients </a>
</nav>
</div>
......@@ -107,7 +109,7 @@
</a>
<div class="collapse" id="cPages" aria-labelledby="headingOne" data-bs-parent="#sidenavAccordion">
<nav class="sb-sidenav-menu-nested nav">
<a class="nav-link" asp-controller="Medicine" asp-action="Create">Add Medicine </a>
<a class="nav-link btn-create" data-Controller="Medicine">Add Medicine </a>
<a class="nav-link" asp-controller="Medicine" asp-action="Index">ALL Medicines </a>
</nav>
</div>
......@@ -213,8 +215,13 @@
});
});
$('.btn-create').on('click', function () {
$('.btn-create').on('click', function () {
var controller = `@ViewData["Controller"]`;
debugger
var id = $(this).data('controller');
if(id)
controller = id;
$('#modal-create').find('.modal-content').load(`/${controller}/create/` );
$('#modal-create').modal('show');
});
......
#pragma checksum "C:\Users\HASAN\Desktop\Medic\WebPresentation\Views\Ingredient\Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3302db48136fd4ef2e2cf1b555107dde6de5327d"
#pragma checksum "C:\Users\HASAN\Desktop\Medic\WebPresentation\Views\Ingredient\Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b738139b3e92349f64647c3d57c377ddd7479488"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_Ingredient_Index), @"mvc.1.0.view", @"/Views/Ingredient/Index.cshtml")]
......@@ -46,14 +46,13 @@ using System;
#line default
#line hidden
#nullable disable
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"3302db48136fd4ef2e2cf1b555107dde6de5327d", @"/Views/Ingredient/Index.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"b738139b3e92349f64647c3d57c377ddd7479488", @"/Views/Ingredient/Index.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"4a2f5fee0d7223f937b9f0309fc3b9062263e26d", @"/Views/_ViewImports.cshtml")]
public class Views_Ingredient_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<IEnumerable<IngredientViewModel>>
{
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-action", "Details", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("m-1 btn btn-info text-info "), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("title", new global::Microsoft.AspNetCore.Html.HtmlString("Details"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("name", "_ValidationScriptsPartial", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("m-1 btn btn-info "), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("name", "_ValidationScriptsPartial", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
#line hidden
#pragma warning disable 0649
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
......@@ -177,7 +176,7 @@ using System;
#line hidden
#nullable disable
WriteLiteral("\">Delete</button>\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3302db48136fd4ef2e2cf1b555107dde6de5327d9498", async() => {
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "b738139b3e92349f64647c3d57c377ddd74794889142", async() => {
WriteLiteral("Details");
}
);
......@@ -201,7 +200,6 @@ using System;
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer;
__tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
......@@ -235,13 +233,13 @@ using System;
");
DefineSection("Scripts", async() => {
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("partial", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "3302db48136fd4ef2e2cf1b555107dde6de5327d12647", async() => {
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("partial", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "b738139b3e92349f64647c3d57c377ddd747948812208", async() => {
}
);
__Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper);
__Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.Name = (string)__tagHelperAttribute_3.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3);
__Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.Name = (string)__tagHelperAttribute_2.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
......
#pragma checksum "C:\Users\HASAN\Desktop\Medic\WebPresentation\Views\Shared\Error.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "c4eee3f4993d74b115dec849687defce31fb03ba"
#pragma checksum "C:\Users\HASAN\Desktop\Medic\WebPresentation\Views\Shared\Error.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "f93d6f0fc50405e0bb699d6e3ffddb42778818ad"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_Shared_Error), @"mvc.1.0.view", @"/Views/Shared/Error.cshtml")]
......@@ -46,7 +46,7 @@ using System;
#line default
#line hidden
#nullable disable
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"c4eee3f4993d74b115dec849687defce31fb03ba", @"/Views/Shared/Error.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"f93d6f0fc50405e0bb699d6e3ffddb42778818ad", @"/Views/Shared/Error.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"4a2f5fee0d7223f937b9f0309fc3b9062263e26d", @"/Views/_ViewImports.cshtml")]
public class Views_Shared_Error : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
......@@ -55,13 +55,33 @@ using System;
{
#nullable restore
#line 1 "C:\Users\HASAN\Desktop\Medic\WebPresentation\Views\Shared\Error.cshtml"
Write(Model);
#line default
#line hidden
#nullable disable
WriteLiteral(" String\r\n");
#nullable restore
#line 2 "C:\Users\HASAN\Desktop\Medic\WebPresentation\Views\Shared\Error.cshtml"
ViewData["Title"] = "Error";
var c = "An error occurred while processing your request.";
if (! (Model== "" || Model is null )) {
c = Model;
}
#line default
#line hidden
#nullable disable
WriteLiteral("\r\n<h1 class=\"text-danger\">Error.</h1>\r\n<h2 class=\"text-danger\">");
#nullable restore
#line 11 "C:\Users\HASAN\Desktop\Medic\WebPresentation\Views\Shared\Error.cshtml"
Write(c);
#line default
#line hidden
#nullable disable
WriteLiteral("\r\n<h1 class=\"text-danger\">Error.</h1>\r\n<h2 class=\"text-danger\">An error occurred while processing your request.</h2>\r\n");
WriteLiteral("</h2>\r\n");
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment