...
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
@using Common.Dtos.User
|
||||
@using Hushian.Application.Dtos
|
||||
|
||||
@using Common.Dtos.Exper
|
||||
@using HushianWebApp.Service
|
||||
@using HushianWebApp.Services
|
||||
@using Common.Validation
|
||||
@inject UserService userService;
|
||||
|
||||
<div class="row" style="height: fit-content; padding: 1rem;">
|
||||
@@ -11,20 +12,7 @@
|
||||
|
||||
<input dir="ltr" style="text-align:center;margin-bottom:10px" @bind-value="@model.FullName" type="text" class="form-control" placeholder="نام و نام خانوادگی" />
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
|
||||
<input dir="ltr" style="text-align:center;margin-bottom:10px" @bind-value="@model.Email" type="text" class="form-control" placeholder="پست الکترونیک" />
|
||||
</div>
|
||||
<div class="col-md-12" style="display: flex;flex-wrap: nowrap;align-items: baseline;">
|
||||
<InputFile type="file" OnChange="OnFileChange" accept=".png" style="margin-bottom:10px" />
|
||||
|
||||
|
||||
@if (model.img != null && model.img.Length > 0)
|
||||
{
|
||||
<Image src="@GetImageSource()" Class="rounded mx-auto d-block" height="25" width="25" alt="Uploaded Image" />
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
<Button Loading=loading LoadingText="در حال ویرایش اطلاعات..." Color="ButtonColor.Warning" @onclick="NewItem"> ویرایش </Button>
|
||||
|
||||
|
||||
@@ -32,7 +20,9 @@
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter] public EditUserFromUserDto model { get; set; }
|
||||
[Inject] protected ToastService ToastService { get; set; } = default!;
|
||||
[Parameter] public Update_ExperDto model { get; set; }
|
||||
[Parameter] public int ExperID { get; set; }
|
||||
[Parameter] public EventCallback OnMultipleOfThree { get; set; }
|
||||
public bool loading { get; set; } = false;
|
||||
}
|
||||
@@ -41,10 +31,13 @@
|
||||
{
|
||||
if (!string.IsNullOrEmpty(model.FullName))
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email)) model.Email = $"{model.UserName}@hushian.ir";
|
||||
|
||||
if (!model.FullName.IsOnlyPersianLetters())
|
||||
{
|
||||
ToastService.Notify(new(ToastType.Danger, $"نام و نام خانوادگی را به صورت فارسی مشخص کنید"));
|
||||
return ;
|
||||
}
|
||||
loading = true;
|
||||
if (await userService.ExperEditingFromManager(model))
|
||||
if (await userService.ExperEditingFromManager(ExperID,model))
|
||||
{
|
||||
loading = false;
|
||||
await OnMultipleOfThree.InvokeAsync();
|
||||
@@ -53,21 +46,5 @@
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnFileChange(InputFileChangeEventArgs e)
|
||||
{
|
||||
var file = e.File;
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
await file.OpenReadStream().CopyToAsync(memoryStream);
|
||||
model.img = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
private string GetImageSource()
|
||||
{
|
||||
if (model.img != null)
|
||||
{
|
||||
return $"data:image/jpeg;base64,{Convert.ToBase64String(model.img)}";
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user