files tree made better.
This commit is contained in:
parent
ffbf032480
commit
ccc91bbf19
1630 changed files with 18209 additions and 41860 deletions
140
src/Yavsc/Controllers/Survey/BugController.cs
Normal file
140
src/Yavsc/Controllers/Survey/BugController.cs
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.IT.Fixing;
|
||||
using Yavsc.Models.IT.Evolution;
|
||||
using System.Linq;
|
||||
using Yavsc.Server.Helpers;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class BugController : Controller
|
||||
{
|
||||
ApplicationDbContext _context;
|
||||
IStringLocalizer<BugController> _localizer;
|
||||
|
||||
public BugController(ApplicationDbContext context, IStringLocalizer<BugController> localizer )
|
||||
{
|
||||
_context = context;
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
// GET: Bug
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
return View(await _context.Bug.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Bug/Details/5
|
||||
public async Task<IActionResult> Details(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
Bug bug = await _context.Bug.SingleAsync(m => m.Id == id);
|
||||
if (bug == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(bug);
|
||||
}
|
||||
|
||||
// GET: Bug/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewBag.Features = Features(_context);
|
||||
ViewBag.Statuses = Statuses(default(BugStatus));
|
||||
return View();
|
||||
}
|
||||
|
||||
IEnumerable<SelectListItem> Statuses(BugStatus ?status) =>
|
||||
typeof(Yavsc.Models.IT.Fixing.BugStatus).CreateSelectListItems(status);
|
||||
IEnumerable<SelectListItem> Features(ApplicationDbContext context) =>
|
||||
context.Feature.CreateSelectListItems<Feature>(f => f.Id.ToString(), f => f.ShortName, null)
|
||||
.AddNull(_localizer["noAttachedFID"]);
|
||||
|
||||
// POST: Bug/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(Bug bug)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Bug.Add(bug);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(bug);
|
||||
}
|
||||
|
||||
// GET: Bug/Edit/5
|
||||
public async Task<IActionResult> Edit(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
Bug bug = await _context.Bug.SingleAsync(m => m.Id == id);
|
||||
if (bug == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
ViewBag.Features = Features(_context);
|
||||
ViewBag.Statuses = Statuses(bug.Status);
|
||||
|
||||
return View(bug);
|
||||
}
|
||||
|
||||
// POST: Bug/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(Bug bug)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(bug);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(bug);
|
||||
}
|
||||
|
||||
// GET: Bug/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
Bug bug = await _context.Bug.SingleAsync(m => m.Id == id);
|
||||
if (bug == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(bug);
|
||||
}
|
||||
|
||||
// POST: Bug/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||
{
|
||||
Bug bug = await _context.Bug.SingleAsync(m => m.Id == id);
|
||||
_context.Bug.Remove(bug);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
130
src/Yavsc/Controllers/Survey/FeatureController.cs
Normal file
130
src/Yavsc/Controllers/Survey/FeatureController.cs
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.Data.Entity;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Models;
|
||||
using Models.IT.Evolution;
|
||||
public class FeatureController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
||||
public FeatureController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: Feature
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
return View(await _context.Feature.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Feature/Details/5
|
||||
public async Task<IActionResult> Details(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
Feature feature = await _context.Feature.SingleAsync(m => m.Id == id);
|
||||
if (feature == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(feature);
|
||||
}
|
||||
|
||||
// GET: Feature/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Feature/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(Feature feature)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Feature.Add(feature);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(feature);
|
||||
}
|
||||
|
||||
// GET: Feature/Edit/5
|
||||
public async Task<IActionResult> Edit(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
Feature feature = await _context.Feature.SingleAsync(m => m.Id == id);
|
||||
if (feature == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
var featureStatusEnumType = typeof(FeatureStatus);
|
||||
var fsstatuses = new List<SelectListItem>();
|
||||
foreach (var v in featureStatusEnumType.GetEnumValues())
|
||||
{
|
||||
fsstatuses.Add(new SelectListItem { Value = v.ToString(), Text = featureStatusEnumType.GetEnumName(v) });
|
||||
}
|
||||
ViewBag.Statuses = fsstatuses;
|
||||
return View(feature);
|
||||
}
|
||||
|
||||
// POST: Feature/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(Feature feature)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(feature);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(feature);
|
||||
}
|
||||
|
||||
// GET: Feature/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
Feature feature = await _context.Feature.SingleAsync(m => m.Id == id);
|
||||
if (feature == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(feature);
|
||||
}
|
||||
|
||||
// POST: Feature/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||
{
|
||||
Feature feature = await _context.Feature.SingleAsync(m => m.Id == id);
|
||||
_context.Feature.Remove(feature);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
12
src/Yavsc/Controllers/Survey/TestController.cs
Normal file
12
src/Yavsc/Controllers/Survey/TestController.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class TestController: Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue