diff --git a/cicm_web/Areas/Admin/Controllers/MachinePhotosController.cs b/cicm_web/Areas/Admin/Controllers/MachinePhotosController.cs new file mode 100644 index 00000000..a3cd2bc4 --- /dev/null +++ b/cicm_web/Areas/Admin/Controllers/MachinePhotosController.cs @@ -0,0 +1,134 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace cicm_web.Areas.Admin.Controllers +{ + [Area("Admin")] + [Authorize] + public class MachinePhotosController : Controller + { + readonly cicmContext _context; + + public MachinePhotosController(cicmContext context) + { + _context = context; + } + + // GET: MachinePhotos + public async Task Index() + { + return View(await _context.MachinePhotos.Include(m => m.Machine).Include(m => m.Machine.Company) + .Include(m => m.User).ToListAsync()); + } + + // GET: MachinePhotos/Details/5 + public async Task Details(Guid? id) + { + if(id == null) return NotFound(); + + MachinePhoto machinePhoto = await _context.MachinePhotos.FirstOrDefaultAsync(m => m.Id == id); + if(machinePhoto == null) return NotFound(); + + return View(machinePhoto); + } + + // GET: MachinePhotos/Create + public IActionResult Create() => View(); + + // POST: MachinePhotos/Create + // To protect from overposting attacks, please enable the specific properties you want to bind to, for + // more details see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Create( + [Bind( + "Author,CameraManufacturer,CameraModel,ColorSpace,Comments,Contrast,CreationDate,DigitalZoomRatio,ExifVersion,Exposure,ExposureMethod,ExposureProgram,Flash,Focal,FocalLength,FocalLengthEquivalent,HorizontalResolution,IsoRating,Lens,License,LightSource,MeteringMode,Orientation,PixelComposition,Saturation,SceneCaptureType,SceneControl,SensingMethod,Sharpness,SoftwareUsed,SubjectDistanceRange,UploadDate,VerticalResolution,WhiteBalance,Id")] + MachinePhoto machinePhoto) + { + if(ModelState.IsValid) + { + machinePhoto.Id = Guid.NewGuid(); + _context.Add(machinePhoto); + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + + return View(machinePhoto); + } + + // GET: MachinePhotos/Edit/5 + public async Task Edit(Guid? id) + { + if(id == null) return NotFound(); + + MachinePhoto machinePhoto = await _context.MachinePhotos.FindAsync(id); + if(machinePhoto == null) return NotFound(); + + return View(machinePhoto); + } + + // POST: MachinePhotos/Edit/5 + // To protect from overposting attacks, please enable the specific properties you want to bind to, for + // more details see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Edit(Guid id, [Bind( + "Author,CameraManufacturer,CameraModel,ColorSpace,Comments,Contrast,CreationDate,DigitalZoomRatio,ExifVersion,Exposure,ExposureMethod,ExposureProgram,Flash,Focal,FocalLength,FocalLengthEquivalent,HorizontalResolution,IsoRating,Lens,License,LightSource,MeteringMode,Orientation,PixelComposition,Saturation,SceneCaptureType,SceneControl,SensingMethod,Sharpness,SoftwareUsed,SubjectDistanceRange,UploadDate,VerticalResolution,WhiteBalance,Id")] + MachinePhoto machinePhoto) + { + if(id != machinePhoto.Id) return NotFound(); + + if(ModelState.IsValid) + { + try + { + _context.Update(machinePhoto); + await _context.SaveChangesAsync(); + } + catch(DbUpdateConcurrencyException) + { + if(!MachinePhotoExists(machinePhoto.Id)) return NotFound(); + + throw; + } + + return RedirectToAction(nameof(Index)); + } + + return View(machinePhoto); + } + + // GET: MachinePhotos/Delete/5 + public async Task Delete(Guid? id) + { + if(id == null) return NotFound(); + + MachinePhoto machinePhoto = await _context.MachinePhotos.FirstOrDefaultAsync(m => m.Id == id); + if(machinePhoto == null) return NotFound(); + + return View(machinePhoto); + } + + // POST: MachinePhotos/Delete/5 + [HttpPost] + [ActionName("Delete")] + [ValidateAntiForgeryToken] + public async Task DeleteConfirmed(Guid id) + { + MachinePhoto machinePhoto = await _context.MachinePhotos.FindAsync(id); + _context.MachinePhotos.Remove(machinePhoto); + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + + bool MachinePhotoExists(Guid id) + { + return _context.MachinePhotos.Any(e => e.Id == id); + } + } +} \ No newline at end of file diff --git a/cicm_web/Areas/Admin/Views/Home/Index.cshtml b/cicm_web/Areas/Admin/Views/Home/Index.cshtml index 4dff0b39..f6709f29 100644 --- a/cicm_web/Areas/Admin/Views/Home/Index.cshtml +++ b/cicm_web/Areas/Admin/Views/Home/Index.cshtml @@ -47,6 +47,7 @@ Instruction set extensions by processor
Machine families
Machines
+ Machine photos
Memory by machines
News
Processors by machines
diff --git a/cicm_web/Areas/Admin/Views/MachinePhotos/Create.cshtml b/cicm_web/Areas/Admin/Views/MachinePhotos/Create.cshtml new file mode 100644 index 00000000..7f997a4f --- /dev/null +++ b/cicm_web/Areas/Admin/Views/MachinePhotos/Create.cshtml @@ -0,0 +1,358 @@ +@model Cicm.Database.Models.MachinePhoto + +@{ + ViewData["Title"] = "Create"; +} + +

Create

+ +

MachinePhoto

+
+
+
+
+
+
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/cicm_web/Areas/Admin/Views/MachinePhotos/Delete.cshtml b/cicm_web/Areas/Admin/Views/MachinePhotos/Delete.cshtml new file mode 100644 index 00000000..ed9dea1b --- /dev/null +++ b/cicm_web/Areas/Admin/Views/MachinePhotos/Delete.cshtml @@ -0,0 +1,228 @@ +@model Cicm.Database.Models.MachinePhoto + +@{ + ViewData["Title"] = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+

MachinePhoto

+
+
+
+ @Html.DisplayNameFor(model => model.Author) +
+
+ @Html.DisplayFor(model => model.Author) +
+
+ @Html.DisplayNameFor(model => model.CameraManufacturer) +
+
+ @Html.DisplayFor(model => model.CameraManufacturer) +
+
+ @Html.DisplayNameFor(model => model.CameraModel) +
+
+ @Html.DisplayFor(model => model.CameraModel) +
+
+ @Html.DisplayNameFor(model => model.ColorSpace) +
+
+ @Html.DisplayFor(model => model.ColorSpace) +
+
+ @Html.DisplayNameFor(model => model.Comments) +
+
+ @Html.DisplayFor(model => model.Comments) +
+
+ @Html.DisplayNameFor(model => model.Contrast) +
+
+ @Html.DisplayFor(model => model.Contrast) +
+
+ @Html.DisplayNameFor(model => model.CreationDate) +
+
+ @Html.DisplayFor(model => model.CreationDate) +
+
+ @Html.DisplayNameFor(model => model.DigitalZoomRatio) +
+
+ @Html.DisplayFor(model => model.DigitalZoomRatio) +
+
+ @Html.DisplayNameFor(model => model.ExifVersion) +
+
+ @Html.DisplayFor(model => model.ExifVersion) +
+
+ @Html.DisplayNameFor(model => model.Exposure) +
+
+ @Html.DisplayFor(model => model.Exposure) +
+
+ @Html.DisplayNameFor(model => model.ExposureMethod) +
+
+ @Html.DisplayFor(model => model.ExposureMethod) +
+
+ @Html.DisplayNameFor(model => model.ExposureProgram) +
+
+ @Html.DisplayFor(model => model.ExposureProgram) +
+
+ @Html.DisplayNameFor(model => model.Flash) +
+
+ @Html.DisplayFor(model => model.Flash) +
+
+ @Html.DisplayNameFor(model => model.Focal) +
+
+ @Html.DisplayFor(model => model.Focal) +
+
+ @Html.DisplayNameFor(model => model.FocalLength) +
+
+ @Html.DisplayFor(model => model.FocalLength) +
+
+ @Html.DisplayNameFor(model => model.FocalLengthEquivalent) +
+
+ @Html.DisplayFor(model => model.FocalLengthEquivalent) +
+
+ @Html.DisplayNameFor(model => model.HorizontalResolution) +
+
+ @Html.DisplayFor(model => model.HorizontalResolution) +
+
+ @Html.DisplayNameFor(model => model.IsoRating) +
+
+ @Html.DisplayFor(model => model.IsoRating) +
+
+ @Html.DisplayNameFor(model => model.Lens) +
+
+ @Html.DisplayFor(model => model.Lens) +
+
+ @Html.DisplayNameFor(model => model.License) +
+
+ @Html.DisplayFor(model => model.License) +
+
+ @Html.DisplayNameFor(model => model.LightSource) +
+
+ @Html.DisplayFor(model => model.LightSource) +
+
+ @Html.DisplayNameFor(model => model.MeteringMode) +
+
+ @Html.DisplayFor(model => model.MeteringMode) +
+
+ @Html.DisplayNameFor(model => model.Orientation) +
+
+ @Html.DisplayFor(model => model.Orientation) +
+
+ @Html.DisplayNameFor(model => model.PixelComposition) +
+
+ @Html.DisplayFor(model => model.PixelComposition) +
+
+ @Html.DisplayNameFor(model => model.Saturation) +
+
+ @Html.DisplayFor(model => model.Saturation) +
+
+ @Html.DisplayNameFor(model => model.SceneCaptureType) +
+
+ @Html.DisplayFor(model => model.SceneCaptureType) +
+
+ @Html.DisplayNameFor(model => model.SceneControl) +
+
+ @Html.DisplayFor(model => model.SceneControl) +
+
+ @Html.DisplayNameFor(model => model.SensingMethod) +
+
+ @Html.DisplayFor(model => model.SensingMethod) +
+
+ @Html.DisplayNameFor(model => model.Sharpness) +
+
+ @Html.DisplayFor(model => model.Sharpness) +
+
+ @Html.DisplayNameFor(model => model.SoftwareUsed) +
+
+ @Html.DisplayFor(model => model.SoftwareUsed) +
+
+ @Html.DisplayNameFor(model => model.SubjectDistanceRange) +
+
+ @Html.DisplayFor(model => model.SubjectDistanceRange) +
+
+ @Html.DisplayNameFor(model => model.UploadDate) +
+
+ @Html.DisplayFor(model => model.UploadDate) +
+
+ @Html.DisplayNameFor(model => model.VerticalResolution) +
+
+ @Html.DisplayFor(model => model.VerticalResolution) +
+
+ @Html.DisplayNameFor(model => model.WhiteBalance) +
+
+ @Html.DisplayFor(model => model.WhiteBalance) +
+
+ +
+ + | + Back to List +
+
\ No newline at end of file diff --git a/cicm_web/Areas/Admin/Views/MachinePhotos/Details.cshtml b/cicm_web/Areas/Admin/Views/MachinePhotos/Details.cshtml new file mode 100644 index 00000000..0d9242e3 --- /dev/null +++ b/cicm_web/Areas/Admin/Views/MachinePhotos/Details.cshtml @@ -0,0 +1,225 @@ +@model Cicm.Database.Models.MachinePhoto + +@{ + ViewData["Title"] = "Details"; +} + +

Details

+ +
+

MachinePhoto

+
+
+
+ @Html.DisplayNameFor(model => model.Author) +
+
+ @Html.DisplayFor(model => model.Author) +
+
+ @Html.DisplayNameFor(model => model.CameraManufacturer) +
+
+ @Html.DisplayFor(model => model.CameraManufacturer) +
+
+ @Html.DisplayNameFor(model => model.CameraModel) +
+
+ @Html.DisplayFor(model => model.CameraModel) +
+
+ @Html.DisplayNameFor(model => model.ColorSpace) +
+
+ @Html.DisplayFor(model => model.ColorSpace) +
+
+ @Html.DisplayNameFor(model => model.Comments) +
+
+ @Html.DisplayFor(model => model.Comments) +
+
+ @Html.DisplayNameFor(model => model.Contrast) +
+
+ @Html.DisplayFor(model => model.Contrast) +
+
+ @Html.DisplayNameFor(model => model.CreationDate) +
+
+ @Html.DisplayFor(model => model.CreationDate) +
+
+ @Html.DisplayNameFor(model => model.DigitalZoomRatio) +
+
+ @Html.DisplayFor(model => model.DigitalZoomRatio) +
+
+ @Html.DisplayNameFor(model => model.ExifVersion) +
+
+ @Html.DisplayFor(model => model.ExifVersion) +
+
+ @Html.DisplayNameFor(model => model.Exposure) +
+
+ @Html.DisplayFor(model => model.Exposure) +
+
+ @Html.DisplayNameFor(model => model.ExposureMethod) +
+
+ @Html.DisplayFor(model => model.ExposureMethod) +
+
+ @Html.DisplayNameFor(model => model.ExposureProgram) +
+
+ @Html.DisplayFor(model => model.ExposureProgram) +
+
+ @Html.DisplayNameFor(model => model.Flash) +
+
+ @Html.DisplayFor(model => model.Flash) +
+
+ @Html.DisplayNameFor(model => model.Focal) +
+
+ @Html.DisplayFor(model => model.Focal) +
+
+ @Html.DisplayNameFor(model => model.FocalLength) +
+
+ @Html.DisplayFor(model => model.FocalLength) +
+
+ @Html.DisplayNameFor(model => model.FocalLengthEquivalent) +
+
+ @Html.DisplayFor(model => model.FocalLengthEquivalent) +
+
+ @Html.DisplayNameFor(model => model.HorizontalResolution) +
+
+ @Html.DisplayFor(model => model.HorizontalResolution) +
+
+ @Html.DisplayNameFor(model => model.IsoRating) +
+
+ @Html.DisplayFor(model => model.IsoRating) +
+
+ @Html.DisplayNameFor(model => model.Lens) +
+
+ @Html.DisplayFor(model => model.Lens) +
+
+ @Html.DisplayNameFor(model => model.License) +
+
+ @Html.DisplayFor(model => model.License) +
+
+ @Html.DisplayNameFor(model => model.LightSource) +
+
+ @Html.DisplayFor(model => model.LightSource) +
+
+ @Html.DisplayNameFor(model => model.MeteringMode) +
+
+ @Html.DisplayFor(model => model.MeteringMode) +
+
+ @Html.DisplayNameFor(model => model.Orientation) +
+
+ @Html.DisplayFor(model => model.Orientation) +
+
+ @Html.DisplayNameFor(model => model.PixelComposition) +
+
+ @Html.DisplayFor(model => model.PixelComposition) +
+
+ @Html.DisplayNameFor(model => model.Saturation) +
+
+ @Html.DisplayFor(model => model.Saturation) +
+
+ @Html.DisplayNameFor(model => model.SceneCaptureType) +
+
+ @Html.DisplayFor(model => model.SceneCaptureType) +
+
+ @Html.DisplayNameFor(model => model.SceneControl) +
+
+ @Html.DisplayFor(model => model.SceneControl) +
+
+ @Html.DisplayNameFor(model => model.SensingMethod) +
+
+ @Html.DisplayFor(model => model.SensingMethod) +
+
+ @Html.DisplayNameFor(model => model.Sharpness) +
+
+ @Html.DisplayFor(model => model.Sharpness) +
+
+ @Html.DisplayNameFor(model => model.SoftwareUsed) +
+
+ @Html.DisplayFor(model => model.SoftwareUsed) +
+
+ @Html.DisplayNameFor(model => model.SubjectDistanceRange) +
+
+ @Html.DisplayFor(model => model.SubjectDistanceRange) +
+
+ @Html.DisplayNameFor(model => model.UploadDate) +
+
+ @Html.DisplayFor(model => model.UploadDate) +
+
+ @Html.DisplayNameFor(model => model.VerticalResolution) +
+
+ @Html.DisplayFor(model => model.VerticalResolution) +
+
+ @Html.DisplayNameFor(model => model.WhiteBalance) +
+
+ @Html.DisplayFor(model => model.WhiteBalance) +
+
+
+ \ No newline at end of file diff --git a/cicm_web/Areas/Admin/Views/MachinePhotos/Edit.cshtml b/cicm_web/Areas/Admin/Views/MachinePhotos/Edit.cshtml new file mode 100644 index 00000000..2872fdd4 --- /dev/null +++ b/cicm_web/Areas/Admin/Views/MachinePhotos/Edit.cshtml @@ -0,0 +1,360 @@ +@model Cicm.Database.Models.MachinePhoto + +@{ + ViewData["Title"] = "Edit"; +} + +

Edit

+ +

MachinePhoto

+
+
+
+
+
+
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+ +
+ +
+
+
+
+ + \ No newline at end of file diff --git a/cicm_web/Areas/Admin/Views/MachinePhotos/Index.cshtml b/cicm_web/Areas/Admin/Views/MachinePhotos/Index.cshtml new file mode 100644 index 00000000..e0345ae3 --- /dev/null +++ b/cicm_web/Areas/Admin/Views/MachinePhotos/Index.cshtml @@ -0,0 +1,244 @@ +@using Cicm.Database.Models +@model IEnumerable + +@{ + ViewData["Title"] = "Index"; +} + +

Index

+ +

+ Create New +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@foreach(MachinePhoto item in Model) +{ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +
+ @Html.DisplayNameFor(model => model.Author) + + @Html.DisplayNameFor(model => model.CameraManufacturer) + + @Html.DisplayNameFor(model => model.CameraModel) + + @Html.DisplayNameFor(model => model.ColorSpace) + + @Html.DisplayNameFor(model => model.Comments) + + @Html.DisplayNameFor(model => model.Contrast) + + @Html.DisplayNameFor(model => model.CreationDate) + + @Html.DisplayNameFor(model => model.DigitalZoomRatio) + + @Html.DisplayNameFor(model => model.ExifVersion) + + @Html.DisplayNameFor(model => model.Exposure) + + @Html.DisplayNameFor(model => model.ExposureMethod) + + @Html.DisplayNameFor(model => model.ExposureProgram) + + @Html.DisplayNameFor(model => model.Flash) + + @Html.DisplayNameFor(model => model.Focal) + + @Html.DisplayNameFor(model => model.FocalLength) + + @Html.DisplayNameFor(model => model.FocalLengthEquivalent) + + @Html.DisplayNameFor(model => model.HorizontalResolution) + + @Html.DisplayNameFor(model => model.IsoRating) + + @Html.DisplayNameFor(model => model.Lens) + + @Html.DisplayNameFor(model => model.License) + + @Html.DisplayNameFor(model => model.LightSource) + + @Html.DisplayNameFor(model => model.MeteringMode) + + @Html.DisplayNameFor(model => model.Orientation) + + @Html.DisplayNameFor(model => model.PixelComposition) + + @Html.DisplayNameFor(model => model.Saturation) + + @Html.DisplayNameFor(model => model.SceneCaptureType) + + @Html.DisplayNameFor(model => model.SceneControl) + + @Html.DisplayNameFor(model => model.SensingMethod) + + @Html.DisplayNameFor(model => model.Sharpness) + + @Html.DisplayNameFor(model => model.SoftwareUsed) + + @Html.DisplayNameFor(model => model.SubjectDistanceRange) + + @Html.DisplayNameFor(model => model.UploadDate) + + @Html.DisplayNameFor(model => model.VerticalResolution) + + @Html.DisplayNameFor(model => model.WhiteBalance) +
+ @Html.DisplayFor(modelItem => item.Author) + + @Html.DisplayFor(modelItem => item.CameraManufacturer) + + @Html.DisplayFor(modelItem => item.CameraModel) + + @Html.DisplayFor(modelItem => item.ColorSpace) + + @Html.DisplayFor(modelItem => item.Comments) + + @Html.DisplayFor(modelItem => item.Contrast) + + @Html.DisplayFor(modelItem => item.CreationDate) + + @Html.DisplayFor(modelItem => item.DigitalZoomRatio) + + @Html.DisplayFor(modelItem => item.ExifVersion) + + @Html.DisplayFor(modelItem => item.Exposure) + + @Html.DisplayFor(modelItem => item.ExposureMethod) + + @Html.DisplayFor(modelItem => item.ExposureProgram) + + @Html.DisplayFor(modelItem => item.Flash) + + @Html.DisplayFor(modelItem => item.Focal) + + @Html.DisplayFor(modelItem => item.FocalLength) + + @Html.DisplayFor(modelItem => item.FocalLengthEquivalent) + + @Html.DisplayFor(modelItem => item.HorizontalResolution) + + @Html.DisplayFor(modelItem => item.IsoRating) + + @Html.DisplayFor(modelItem => item.Lens) + + @Html.DisplayFor(modelItem => item.License) + + @Html.DisplayFor(modelItem => item.LightSource) + + @Html.DisplayFor(modelItem => item.MeteringMode) + + @Html.DisplayFor(modelItem => item.Orientation) + + @Html.DisplayFor(modelItem => item.PixelComposition) + + @Html.DisplayFor(modelItem => item.Saturation) + + @Html.DisplayFor(modelItem => item.SceneCaptureType) + + @Html.DisplayFor(modelItem => item.SceneControl) + + @Html.DisplayFor(modelItem => item.SensingMethod) + + @Html.DisplayFor(modelItem => item.Sharpness) + + @Html.DisplayFor(modelItem => item.SoftwareUsed) + + @Html.DisplayFor(modelItem => item.SubjectDistanceRange) + + @Html.DisplayFor(modelItem => item.UploadDate) + + @Html.DisplayFor(modelItem => item.VerticalResolution) + + @Html.DisplayFor(modelItem => item.WhiteBalance) + + + Edit + | + + Details + | + + Delete + +
\ No newline at end of file diff --git a/cicm_web/cicm_web.csproj b/cicm_web/cicm_web.csproj index 0efdba1a..b2dabffb 100644 --- a/cicm_web/cicm_web.csproj +++ b/cicm_web/cicm_web.csproj @@ -2,7 +2,7 @@ netcoreapp2.2 - 3.0.99.578 + 3.0.99.582 Canary Islands Computer Museum Copyright © 2003-2018 Natalia Portillo Canary Islands Computer Museum Website