bugs & features
This commit is contained in:
@ -423,17 +423,19 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var user = await _userManager.FindByEmailAsync(model.LoginOrEmail);
|
||||
ApplicationUser user;
|
||||
if (model.LoginOrEmail.Contains('@')) {
|
||||
user = await _userManager.FindByEmailAsync(model.LoginOrEmail);
|
||||
}
|
||||
else {
|
||||
user = await _userManager.FindByNameAsync(model.LoginOrEmail);
|
||||
}
|
||||
|
||||
// Don't reveal that the user does not exist or is not confirmed
|
||||
if (user == null)
|
||||
{
|
||||
user = await _userManager.FindByNameAsync(model.LoginOrEmail);
|
||||
if (user == null)
|
||||
{
|
||||
_logger.LogWarning($"ForgotPassword: Email or User name {model.LoginOrEmail} not found");
|
||||
return View("ForgotPasswordConfirmation");
|
||||
}
|
||||
_logger.LogWarning($"ForgotPassword: Email or User name {model.LoginOrEmail} not found");
|
||||
return View("ForgotPasswordConfirmation");
|
||||
}
|
||||
// user != null
|
||||
// We want him to have a confirmed e-mail, and prevent this script
|
||||
|
122
Yavsc/Controllers/BugController.cs
Normal file
122
Yavsc/Controllers/BugController.cs
Normal file
@ -0,0 +1,122 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.Data.Entity;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.IT.Fixing;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class BugController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
||||
public BugController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// 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()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
122
Yavsc/Controllers/FeatureController.cs
Normal file
122
Yavsc/Controllers/FeatureController.cs
Normal file
@ -0,0 +1,122 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.Data.Entity;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.IT.Maintaining;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
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();
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user