simpler, better
This commit is contained in:
parent
f89cf9c2f1
commit
dc1b82ab1b
27 changed files with 3323 additions and 50 deletions
|
|
@ -411,9 +411,9 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
// Renames the blog files
|
||||
var userdirinfo = new DirectoryInfo(
|
||||
Path.Combine(_siteSettings.UserFiles.Blog,
|
||||
Path.Combine(_siteSettings.Blog,
|
||||
oldUserName));
|
||||
var newdir = Path.Combine(_siteSettings.UserFiles.Blog,
|
||||
var newdir = Path.Combine(_siteSettings.Blog,
|
||||
model.NewUserName);
|
||||
if (userdirinfo.Exists)
|
||||
userdirinfo.MoveTo(newdir);
|
||||
|
|
@ -421,10 +421,10 @@ namespace Yavsc.Controllers
|
|||
foreach (string s in new string [] { ".png", ".s.png", ".xs.png" })
|
||||
{
|
||||
FileInfo fi = new FileInfo(
|
||||
Path.Combine(_siteSettings.UserFiles.Avatars,
|
||||
Path.Combine(_siteSettings.Avatars,
|
||||
oldUserName+s));
|
||||
if (fi.Exists)
|
||||
fi.MoveTo(Path.Combine(_siteSettings.UserFiles.Avatars,
|
||||
fi.MoveTo(Path.Combine(_siteSettings.Avatars,
|
||||
model.NewUserName+s));
|
||||
}
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ namespace Yavsc.Controllers
|
|||
);
|
||||
|
||||
var billsdir = Path.Combine(
|
||||
_site.UserFiles.Bills,
|
||||
_site.Bills,
|
||||
perfomerProfile.Performer.UserName
|
||||
);
|
||||
|
||||
|
|
|
|||
127
Yavsc/Controllers/GitController.cs
Normal file
127
Yavsc/Controllers/GitController.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
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.Server.Models.IT.SourceCode;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class GitController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
||||
public GitController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: Git
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
var applicationDbContext = _context.GitRepositoryReference.Include(g => g.Owner);
|
||||
return View(await applicationDbContext.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Git/Details/5
|
||||
public async Task<IActionResult> Details(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
GitRepositoryReference gitRepositoryReference = await _context.GitRepositoryReference.SingleAsync(m => m.Path == id);
|
||||
if (gitRepositoryReference == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(gitRepositoryReference);
|
||||
}
|
||||
|
||||
// GET: Git/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner");
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Git/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(GitRepositoryReference gitRepositoryReference)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.GitRepositoryReference.Add(gitRepositoryReference);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner", gitRepositoryReference.OwnerId);
|
||||
return View(gitRepositoryReference);
|
||||
}
|
||||
|
||||
// GET: Git/Edit/5
|
||||
public async Task<IActionResult> Edit(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
GitRepositoryReference gitRepositoryReference = await _context.GitRepositoryReference.SingleAsync(m => m.Path == id);
|
||||
if (gitRepositoryReference == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner", gitRepositoryReference.OwnerId);
|
||||
return View(gitRepositoryReference);
|
||||
}
|
||||
|
||||
// POST: Git/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(GitRepositoryReference gitRepositoryReference)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(gitRepositoryReference);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner", gitRepositoryReference.OwnerId);
|
||||
return View(gitRepositoryReference);
|
||||
}
|
||||
|
||||
// GET: Git/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
GitRepositoryReference gitRepositoryReference = await _context.GitRepositoryReference.SingleAsync(m => m.Path == id);
|
||||
if (gitRepositoryReference == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(gitRepositoryReference);
|
||||
}
|
||||
|
||||
// POST: Git/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||
{
|
||||
GitRepositoryReference gitRepositoryReference = await _context.GitRepositoryReference.SingleAsync(m => m.Path == id);
|
||||
_context.GitRepositoryReference.Remove(gitRepositoryReference);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue