mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add source URL to machine photos.
This commit is contained in:
5402
Cicm.Database/Migrations/20190528234633_AddMachinePhotoSourceUrl.Designer.cs
generated
Normal file
5402
Cicm.Database/Migrations/20190528234633_AddMachinePhotoSourceUrl.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
public partial class AddMachinePhotoSourceUrl : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>("Source", "MachinePhotos", nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn("Source", "MachinePhotos");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3772,6 +3772,8 @@ namespace Cicm.Database.Migrations
|
||||
|
||||
b.Property<string>("SoftwareUsed");
|
||||
|
||||
b.Property<string>("Source");
|
||||
|
||||
b.Property<ushort?>("SubjectDistanceRange");
|
||||
|
||||
b.Property<DateTime>("UploadDate").IsConcurrencyToken().ValueGeneratedOnAddOrUpdate();
|
||||
|
||||
@@ -64,6 +64,8 @@ namespace Cicm.Database.Models
|
||||
public double? VerticalResolution { get; set; }
|
||||
[DisplayName("White balance")]
|
||||
public WhiteBalance? WhiteBalance { get; set; }
|
||||
[Url]
|
||||
public string Source { get; set; }
|
||||
|
||||
public virtual ApplicationUser User { get; set; }
|
||||
public virtual Machine Machine { get; set; }
|
||||
|
||||
@@ -104,7 +104,8 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
UploadUser = m.User.UserName,
|
||||
Machine =
|
||||
$"{m.Machine.Company.Name} {m.Machine.Name}",
|
||||
MachineId = m.Machine.Id
|
||||
MachineId = m.Machine.Id,
|
||||
Source = m.Source
|
||||
}).FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(machinePhoto == null) return NotFound();
|
||||
|
||||
@@ -128,7 +129,8 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create([Bind("MachineId,LicenseId,Photo")] MachinePhotoViewModel machinePhoto)
|
||||
public async Task<IActionResult> Create([Bind("MachineId,LicenseId,Photo,Source")]
|
||||
MachinePhotoViewModel machinePhoto)
|
||||
{
|
||||
if(!ModelState.IsValid) return View(machinePhoto);
|
||||
|
||||
@@ -395,7 +397,7 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(Guid id, [Bind(
|
||||
"Author,CameraManufacturer,CameraModel,ColorSpace,Comments,Contrast,CreationDate,DigitalZoomRatio,ExifVersion,Exposure,ExposureMethod,ExposureProgram,Flash,Focal,FocalLength,FocalLengthEquivalent,HorizontalResolution,IsoRating,Lens,LicenseId,LightSource,MachineId,MeteringMode,ResolutionUnit,Orientation,Saturation,SceneCaptureType,SensingMethod,Sharpness,SoftwareUsed,SubjectDistanceRange,VerticalResolution,WhiteBalance,Id")]
|
||||
"Author,CameraManufacturer,CameraModel,ColorSpace,Comments,Contrast,CreationDate,DigitalZoomRatio,ExifVersion,Exposure,ExposureMethod,ExposureProgram,Flash,Focal,FocalLength,FocalLengthEquivalent,HorizontalResolution,IsoRating,Lens,LicenseId,LightSource,MachineId,MeteringMode,ResolutionUnit,Orientation,Saturation,SceneCaptureType,SensingMethod,Sharpness,SoftwareUsed,SubjectDistanceRange,VerticalResolution,WhiteBalance,Id,Source")]
|
||||
MachinePhoto machinePhoto)
|
||||
{
|
||||
if(id != machinePhoto.Id) return NotFound();
|
||||
|
||||
@@ -71,5 +71,6 @@ namespace cicm_web.Areas.Admin.Models
|
||||
public string UploadUser { get; set; }
|
||||
public string Machine { get; set; }
|
||||
public int MachineId { get; set; }
|
||||
public string Source { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -22,5 +22,7 @@ namespace cicm_web.Areas.Admin.Models
|
||||
public int MachineId { get; set; }
|
||||
public int LicenseId { get; set; }
|
||||
public string ErrorMessage { get; set; }
|
||||
[Url]
|
||||
public string Source { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,13 @@
|
||||
class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Source"
|
||||
class="control-label">
|
||||
</label>
|
||||
<input asp-for="Source"
|
||||
class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Photo"
|
||||
class="control-label">
|
||||
|
||||
@@ -32,10 +32,23 @@
|
||||
@Html.DisplayNameFor(model => model.Machine)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
<a asp-area="" asp-controller="Machine" asp-route-id="@Model.MachineId" asp-action="View" target="_blank">
|
||||
@Html.DisplayFor(model => model.Machine)
|
||||
<a asp-area=""
|
||||
asp-controller="Machine"
|
||||
asp-route-id="@Model.MachineId"
|
||||
asp-action="View"
|
||||
target="_blank">
|
||||
@Html.DisplayFor(model => model.Machine)
|
||||
</a>
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Source)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@if(Model.Source != null)
|
||||
{
|
||||
<a hred="@Html.DisplayFor(model => model.Source)">Link</a>
|
||||
}
|
||||
</dd>
|
||||
<dd class="col-sm-10">
|
||||
<img src="/assets/photos/machines/@(Model.Id).jpg" />
|
||||
</dd>
|
||||
|
||||
@@ -355,6 +355,16 @@
|
||||
class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Source"
|
||||
class="control-label">
|
||||
</label>
|
||||
<input asp-for="Source"
|
||||
class="form-control" />
|
||||
<span asp-validation-for="Source"
|
||||
class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="SubjectDistanceRange"
|
||||
class="control-label">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.649</Version>
|
||||
<Version>3.0.99.651</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user