Dati azienda dettaglio e eliminazione
This commit is contained in:
parent
d7f4ad0f40
commit
4845c549b6
@ -212,7 +212,7 @@ namespace VirtualTask.Controllers
|
||||
string pic = System.IO.Path.GetFileName(model.logo2.FileName);
|
||||
string path = string.Format("{0}{1}\\{2}", _pathLoghi, tenant2, pic);
|
||||
//string projectRootPath = _hostingEnvironment.ContentRootPath;
|
||||
|
||||
|
||||
//// file is uploaded
|
||||
using (Stream fileStream = new FileStream(path, FileMode.Create))
|
||||
{
|
||||
@ -229,6 +229,7 @@ namespace VirtualTask.Controllers
|
||||
model.logo = array;
|
||||
}
|
||||
model.logo2 = null;
|
||||
model.url_logo = string.Format("{0}{1}/{2}", _urlLoghi, tenant2, pic); ;
|
||||
}
|
||||
|
||||
|
||||
@ -256,8 +257,116 @@ namespace VirtualTask.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DETAIL
|
||||
public IActionResult Detail(string azienda, string tecnico)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
token = helper.GetStringValue("tok");
|
||||
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
urlBase = apiUrl + "datiaziendaList";
|
||||
urlBase = urlBase + "?token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
DatiAziendaTable dat = new DatiAziendaTable();
|
||||
List<DatiAziendaTable> modelList = new List<DatiAziendaTable>();
|
||||
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
modelList = JsonConvert.DeserializeObject<List<DatiAziendaTable>>(data);
|
||||
dat = modelList.Where(t => t.azienda.Equals(azienda) && t.tecnico.Equals(tecnico)).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
|
||||
|
||||
|
||||
ViewBag.AllTecnici = getTecnici();
|
||||
return View(dat);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DELETE
|
||||
[HttpGet]
|
||||
public IActionResult Delete(string azienda, string tecnico)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
urlBase = apiUrl + "datiaziendaList";
|
||||
urlBase = urlBase + "?token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
DatiAziendaTable dat = new DatiAziendaTable();
|
||||
|
||||
List<DatiAziendaTable> modelList = new List<DatiAziendaTable>();
|
||||
|
||||
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
modelList = JsonConvert.DeserializeObject<List<DatiAziendaTable>>(data);
|
||||
dat = modelList.Where(x => x.azienda.Equals(azienda) && x.tecnico.Equals(tecnico)).First();
|
||||
}
|
||||
|
||||
return View(dat);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("DeleteConfirmed")]
|
||||
public IActionResult DeleteConfirmed(string azienda, string tecnico)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
tenant = helper.GetStringValue("tenant");
|
||||
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
urlBase = apiUrl + "datiazienda/del";
|
||||
urlBase = urlBase + "?azienda=" + azienda;
|
||||
urlBase = urlBase + "&tecnico=" + tecnico;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
string data = JsonConvert.SerializeObject(azienda);
|
||||
StringContent content = new StringContent(data, Encoding.UTF8, "application/json");
|
||||
HttpResponseMessage response = client.PostAsync(baseAddress, content).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
}
|
||||
#endregion DELETE
|
||||
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
@ -4,49 +4,49 @@
|
||||
ViewData["Title"] = "Nuovo";
|
||||
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
||||
}
|
||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Create" enctype="multipart/form-data">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
|
||||
<h1>Create</h1>
|
||||
|
||||
<h4>DatiAzienda</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Create" enctype="multipart/form-data">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
|
||||
@Html.HiddenFor(x => x.azienda)
|
||||
@Html.HiddenFor(x => x.url_logo)
|
||||
<div class="form-group">
|
||||
<label asp-for="tecnico" class="control-label"></label>
|
||||
@Html.DropDownListFor(x =>x.tecnico,(IEnumerable<SelectListItem>)ViewBag.AllTecnici,new {@class = "form-control"})
|
||||
<span asp-validation-for="tecnico" class="text-danger"></span>
|
||||
@Html.HiddenFor(x => x.azienda)
|
||||
@Html.HiddenFor(x => x.url_logo)
|
||||
<div class="form-group">
|
||||
<label asp-for="tecnico" class="control-label"></label>
|
||||
@Html.DropDownListFor(x =>x.tecnico,(IEnumerable<SelectListItem>)ViewBag.AllTecnici,new {@class = "form-control"})
|
||||
<span asp-validation-for="tecnico" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ragsoc" class="control-label"></label>
|
||||
<input asp-for="ragsoc" class="form-control" />
|
||||
<span asp-validation-for="ragsoc" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="logo" class="control-label"></label>
|
||||
<input type="file" asp-for="logo" />
|
||||
<span asp-validation-for="logo" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="testo_buono" class="control-label"></label>
|
||||
@*<input asp-for="testo_buono" class="form-control" />*@
|
||||
<textarea asp-for="testo_buono" class="form-control"></textarea>
|
||||
<span asp-validation-for="testo_buono" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Create" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ragsoc" class="control-label"></label>
|
||||
<input asp-for="ragsoc" class="form-control" />
|
||||
<span asp-validation-for="ragsoc" class="text-danger"></span>
|
||||
<div>
|
||||
<a asp-action="Index">Torna alla lista</a>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="logo" class="control-label"></label>
|
||||
<input type="file" asp-for="logo" />
|
||||
<span asp-validation-for="logo" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="testo_buono" class="control-label"></label>
|
||||
@*<input asp-for="testo_buono" class="form-control" />*@
|
||||
<textarea asp-for="testo_buono" class="form-control"></textarea>
|
||||
<span asp-validation-for="testo_buono" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Create" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
<script src="~/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
|
||||
74
Views/DatiAzienda/Delete.cshtml
Normal file
74
Views/DatiAzienda/Delete.cshtml
Normal file
@ -0,0 +1,74 @@
|
||||
@model VirtualTask.Models.DatiAziendaTable
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Elimina";
|
||||
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
||||
}
|
||||
|
||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.azienda)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.azienda)
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.logo)
|
||||
</dt>
|
||||
<dd>
|
||||
@{
|
||||
var base64 = Convert.ToBase64String(Model.logo);
|
||||
var imgSrc = String.Format("data:image/gif;base64,{0}", base64);
|
||||
}
|
||||
<img src="@imgSrc" height="80" />
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.tecnico)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.tecnico)
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.ragsoc)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.ragsoc)
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.url_logo)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.url_logo)
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.testo_buono)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@{
|
||||
string testo = string.Empty;
|
||||
testo = Model.testo_buono;
|
||||
}
|
||||
@Html.Raw(@testo)
|
||||
</dd>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<form asp-action="DeleteConfirmed">
|
||||
<input type="submit" value="Elimina" class="agy-btn submitForm" />
|
||||
<input type="hidden" id="azienda" value=@Html.DisplayFor(model => model.azienda) name="azienda" />
|
||||
<input type="hidden" id="tecnico" value=@Html.DisplayFor(model => model.tecnico) name="tecnico" />
|
||||
<div>
|
||||
<a asp-action="Index">Torna alla lista</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
51
Views/DatiAzienda/Detail.cshtml
Normal file
51
Views/DatiAzienda/Detail.cshtml
Normal file
@ -0,0 +1,51 @@
|
||||
@model VirtualTask.Models.DatiAziendaTable
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Dettaglio";
|
||||
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
||||
}
|
||||
|
||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<b>@Html.DisplayNameFor(model => model.azienda)</b> @Html.DisplayFor(model => model.azienda)
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
@{
|
||||
var base64 = Convert.ToBase64String(Model.logo);
|
||||
var imgSrc = String.Format("data:image/gif;base64,{0}", base64);
|
||||
}
|
||||
<img src="@imgSrc" height="80" />
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<b>@Html.DisplayNameFor(model => model.tecnico)</b> @Html.DisplayFor(model => model.tecnico)
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<b>@Html.DisplayNameFor(model => model.ragsoc)</b> @Html.DisplayFor(model => model.ragsoc)
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<b>@Html.DisplayNameFor(model => model.url_logo)</b> @Html.DisplayFor(model => model.url_logo)
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<b>@Html.DisplayNameFor(model => model.testo_buono)</b>
|
||||
@{
|
||||
string testo = string.Empty;
|
||||
testo = Model.testo_buono;
|
||||
}
|
||||
@Html.Raw(@testo)
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div>
|
||||
<a asp-action="Index" value="Torna alla lista" class="agy-btn submitForm">Torna alla lista</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -61,19 +61,16 @@
|
||||
|
||||
</td>
|
||||
<td>
|
||||
@* @Html.ActionLink("Edit", "Edit", new { azienda=item.azienda,tecnico=item.tecnico }) |
|
||||
@Html.ActionLink("Details", "Details", new { azienda=item.azienda,tecnico=item.tecnico }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { azienda=item.azienda,tecnico=item.tecnico })*@
|
||||
|
||||
<a href="@Url.Action("Edit", "DatiAzienda", new { azienda=item.azienda,tecnico=item.tecnico })" title="Modifica" class="links">
|
||||
<img alt="Modifica" src="@Url.Content("~/assets/images/icons8-modificare-64.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
|
|
||||
<a href="@Url.Action("Details", "DatiAzienda", new { azienda=item.azienda,tecnico=item.tecnico })" title="Dettaglio" class="links" style="visibility:hidden;">
|
||||
<a href="@Url.Action("Detail", "DatiAzienda", new { azienda=item.azienda,tecnico=item.tecnico })" title="Dettaglio" class="links">
|
||||
<img alt="Dettaglio" src="@Url.Content("~/assets/images/icons8-visualizza-file-64.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
|
|
||||
<a href="@Url.Action("Delete", "DatiAzienda", new { azienda=item.azienda,tecnico=item.tecnico })" title="Elimina" class="links" style="visibility:hidden;">
|
||||
<a href="@Url.Action("Delete", "DatiAzienda", new { azienda=item.azienda,tecnico=item.tecnico })" title="Elimina" class="links">
|
||||
<img alt="Elimina" src="@Url.Content("~/assets/images/icons8-elimina-50.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
|
||||
|
||||
@ -7,14 +7,14 @@
|
||||
},
|
||||
"ApplicationInsights": {
|
||||
//PRODUZIONE
|
||||
"rootUrlApi": "https://api.poloinformatico.it:9000/api/Polo/",
|
||||
"rootWebLoghi": "C:\\ZAPIPOLO\\api_polo\\wwwroot\\VIRTU\\",
|
||||
"rootUrlApi2": "https://api.poloinformatico.it:9000/VIRTU/",
|
||||
//"rootUrlApi": "https://api.poloinformatico.it:9000/api/Polo/",
|
||||
//"rootWebLoghi": "C:\\ZAPIPOLO\\api_polo\\wwwroot\\VIRTU\\",
|
||||
//"rootUrlApi2": "https://api.poloinformatico.it:9000/VIRTU/",
|
||||
|
||||
//TEST
|
||||
//"rootUrlApi": "http://testapi.poloinformatico.it:9001/api/Polo/",
|
||||
//"rootWebLoghi": "C:\\SORGENTI\\_publish\\wwwroot\\VIRTU\\",
|
||||
//"rootUrlApi2": "http://testapi.poloinformatico.it:9001/VIRTU/",
|
||||
"rootUrlApi": "http://testapi.poloinformatico.it:9001/api/Polo/",
|
||||
"rootWebLoghi": "C:\\SORGENTI\\_publish\\wwwroot\\VIRTU\\",
|
||||
"rootUrlApi2": "http://testapi.poloinformatico.it:9001/VIRTU/",
|
||||
|
||||
"mittenteMail": "info@virtualtask.it",
|
||||
"nomeMail": "Supporto Virtual Task",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user