compilation warnings

main
Paul Schneider 9 years ago
parent c1e44914f6
commit c01a33aba8
18 changed files with 46 additions and 33 deletions

@ -9,6 +9,7 @@ using Yavsc.Models;
namespace Yavsc.ApiControllers namespace Yavsc.ApiControllers
{ {
using System.Threading.Tasks;
using Yavsc.Exceptions; using Yavsc.Exceptions;
public class FSQuotaException : Exception { public class FSQuotaException : Exception {
@ -43,16 +44,20 @@ namespace Yavsc.ApiControllers
return Ok(files); return Ok(files);
} }
[HttpPost] [HttpPost]
public IEnumerable<IActionResult> Post(string subdir="") public IEnumerable<IActionResult> Post(string subdir="")
{ {
string root = null; string root = null;
InvalidPathException pathex = null;
try { try {
root = User.InitPostToFileSystem(subdir); root = User.InitPostToFileSystem(subdir);
} catch (InvalidPathException) {} } catch (InvalidPathException ex) {
if (root==null) pathex = ex;
yield return new BadRequestObjectResult(new { error= "InvalidPathException" }); }
if (pathex!=null)
yield return new BadRequestObjectResult(pathex);
var user = dbContext.Users.Single( var user = dbContext.Users.Single(
u => u.Id == User.GetUserId() u => u.Id == User.GetUserId()
); );
@ -64,5 +69,25 @@ namespace Yavsc.ApiControllers
yield return Ok(item); yield return Ok(item);
}; };
} }
[HttpDelete]
public async Task <IActionResult> Delete (string id)
{
var user = dbContext.Users.Single(
u => u.Id == User.GetUserId()
);
InvalidPathException pathex = null;
string root = null;
try {
root = User.InitPostToFileSystem(id);
} catch (InvalidPathException ex) {
pathex = ex;
}
if (pathex!=null)
return new BadRequestObjectResult(pathex);
user.DeleteUserFile(id);
await dbContext.SaveChangesAsync(User.GetUserId());
return Ok(new { deleted=id });
}
} }
} }

@ -3,12 +3,11 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Yavsc.Exceptions;
using Yavsc.Models;
using Yavsc;
namespace Yavsc.Controllers.Generic namespace Yavsc.Controllers.Generic
{ {
using Exceptions;
using Models;
[Authorize] [Authorize]
public abstract class SettingsController<TSettings> : Controller where TSettings : class, ISpecializationSettings, new() public abstract class SettingsController<TSettings> : Controller where TSettings : class, ISpecializationSettings, new()
{ {

@ -65,7 +65,14 @@ namespace Yavsc.Helpers
return root; return root;
} }
public static void DeleteUserFile(this ApplicationUser user, string fileName)
{
var root = Path.Combine(Startup.UserFilesDirName, user.UserName);
var fi = new FileInfo(Path.Combine(root, fileName));
if (!fi.Exists) return ;
fi.Delete();
user.DiskUsage -= fi.Length;
}
public static FileRecievedInfo ReceiveUserFile(this ApplicationUser user, string root, IFormFile f) public static FileRecievedInfo ReceiveUserFile(this ApplicationUser user, string root, IFormFile f)
{ {
long usage = user.DiskUsage; long usage = user.DiskUsage;

@ -1,6 +1,4 @@
using Yavsc; namespace Yavsc.Interfaces
namespace Yavsc.Interfaces
{ {
public interface ICircleMember: IIdentified<long> public interface ICircleMember: IIdentified<long>
{ {

@ -1,7 +1,6 @@
using System; using System;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure; using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations; using Microsoft.Data.Entity.Migrations;
using Yavsc.Models; using Yavsc.Models;

@ -9,7 +9,6 @@ namespace Yavsc.Models.Billing
{ {
using Models.Workflow; using Models.Workflow;
using Newtonsoft.Json; using Newtonsoft.Json;
using Yavsc.Workflow;
public partial class Estimate : IEstimate public partial class Estimate : IEstimate
{ {

@ -5,7 +5,6 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using Yavsc.Models.Access; using Yavsc.Models.Access;
using Yavsc;
namespace Yavsc.Models namespace Yavsc.Models
{ {

@ -2,7 +2,6 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json; using Newtonsoft.Json;
using Yavsc.Models.Workflow; using Yavsc.Models.Workflow;
using Yavsc;
namespace Yavsc.Models.Haircut namespace Yavsc.Models.Haircut
{ {

@ -2,7 +2,6 @@ using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Yavsc.Models.Auth; using Yavsc.Models.Auth;
using Yavsc.Models.Relationship; using Yavsc.Models.Relationship;
using Yavsc;
namespace Yavsc.Models.Haircut.Views namespace Yavsc.Models.Haircut.Views
{ {

@ -1,7 +1,6 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Yavsc;
namespace Yavsc.Models.IT.Modeling namespace Yavsc.Models.IT.Modeling
{ {

@ -1,6 +1,4 @@
using Yavsc;
namespace Yavsc.Models.IT.Modeling namespace Yavsc.Models.IT.Modeling
{ {
public abstract class Letter<T> : ILetter<T> public abstract class Letter<T> : ILetter<T>

@ -1,6 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Yavsc;
namespace Yavsc.Models.Musical.Profiles namespace Yavsc.Models.Musical.Profiles
{ {

@ -1,6 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Yavsc;
namespace Yavsc.Models.Musical.Profiles namespace Yavsc.Models.Musical.Profiles
{ {

@ -1,6 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Workflow; using Yavsc.Models.Workflow;
using Yavsc;
namespace Yavsc.Models.Musical.Profiles namespace Yavsc.Models.Musical.Profiles
{ {

@ -4,12 +4,11 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Yavsc.Exceptions;
using Yavsc.Models;
using Yavsc;
namespace Yavsc namespace Yavsc
{ {
using Exceptions;
using Models;
public partial class Startup public partial class Startup
{ {
/// <summary> /// <summary>

@ -28,7 +28,6 @@ namespace Yavsc
using System.Net; using System.Net;
using Formatters; using Formatters;
using Models; using Models;
using Newtonsoft.Json;
using PayPal.Manager; using PayPal.Manager;
using Services; using Services;
using ViewModels.Auth.Handlers; using ViewModels.Auth.Handlers;

@ -1,13 +1,12 @@
using System.Linq; using System.Linq;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering; using Microsoft.AspNet.Mvc.Rendering;
using Yavsc.Models;
using Yavsc.ViewModels.Controls;
using Yavsc.ViewModels.Relationship;
using Yavsc;
namespace Yavsc.ViewComponents namespace Yavsc.ViewComponents
{ {
using Models;
using ViewModels.Controls;
using ViewModels.Relationship;
public class CirclesControlViewComponent : ViewComponent public class CirclesControlViewComponent : ViewComponent
{ {
ApplicationDbContext dbContext; ApplicationDbContext dbContext;

@ -1,5 +1,3 @@
using Yavsc;
namespace Yavsc.ViewModels.Relationship namespace Yavsc.ViewModels.Relationship
{ {
public class CirclesViewModel public class CirclesViewModel

Loading…