FIXME SR is private
This commit is contained in:
parent
8929cc9bfa
commit
123283f277
576 changed files with 75350 additions and 13070 deletions
|
|
@ -1,10 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Blog;
|
||||
|
||||
|
|
@ -36,14 +37,14 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogPost blog = _context.Blogspot.Single(m => m.Id == id);
|
||||
|
||||
if (blog == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(blog);
|
||||
|
|
@ -55,12 +56,12 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != blog.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(blog).State = EntityState.Modified;
|
||||
|
|
@ -73,7 +74,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!BlogExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -81,7 +82,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/BlogApi
|
||||
|
|
@ -90,7 +91,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Blogspot.Add(blog);
|
||||
|
|
@ -102,7 +103,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (BlogExists(blog.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -119,13 +120,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogPost blog = _context.Blogspot.Single(m => m.Id == id);
|
||||
if (blog == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Blogspot.Remove(blog);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Blog;
|
||||
namespace Yavsc.Controllers
|
||||
|
|
@ -32,14 +32,14 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogTag blogTag = await _context.TagsDomain.SingleAsync(m => m.PostId == id);
|
||||
|
||||
if (blogTag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(blogTag);
|
||||
|
|
@ -51,12 +51,12 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != blogTag.PostId)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(blogTag).State = EntityState.Modified;
|
||||
|
|
@ -69,7 +69,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!BlogTagExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -77,7 +77,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/BlogTagsApi
|
||||
|
|
@ -86,7 +86,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.TagsDomain.Add(blogTag);
|
||||
|
|
@ -98,7 +98,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (BlogTagExists(blogTag.PostId))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -115,13 +115,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogTag blogTag = await _context.TagsDomain.SingleAsync(m => m.PostId == id);
|
||||
if (blogTag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.TagsDomain.Remove(blogTag);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Blog;
|
||||
|
||||
|
|
@ -34,14 +31,14 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Comment comment = await _context.Comment.SingleAsync(m => m.Id == id);
|
||||
|
||||
if (comment == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(comment);
|
||||
|
|
@ -53,12 +50,12 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != comment.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(comment).State = EntityState.Modified;
|
||||
|
|
@ -71,7 +68,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!CommentExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -79,7 +76,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/CommentsApi
|
||||
|
|
@ -106,7 +103,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (CommentExists(comment.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -122,13 +119,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Comment comment = await _context.Comment.SingleAsync(m => m.Id == id);
|
||||
if (comment == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
RemoveRecursive(comment);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
|
|
@ -63,11 +61,11 @@ namespace Yavsc.ApiControllers
|
|||
}
|
||||
if (pathex!=null) {
|
||||
_logger.LogError($"invalid sub path: '{subdir}'.");
|
||||
return HttpBadRequest(pathex);
|
||||
return BadRequest(pathex);
|
||||
}
|
||||
_logger.LogInformation($"Receiving files, saved in '{destDir}' (specified as '{subdir}').");
|
||||
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var user = dbContext.Users.Single(
|
||||
u => u.Id == uid
|
||||
);
|
||||
|
|
@ -91,7 +89,7 @@ namespace Yavsc.ApiControllers
|
|||
[Authorize("AdministratorOnly")]
|
||||
public IActionResult AddQuota(string uname, int len)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var user = dbContext.Users.FirstOrDefault(
|
||||
u => u.UserName == uname
|
||||
);
|
||||
|
|
@ -107,7 +105,7 @@ namespace Yavsc.ApiControllers
|
|||
public IActionResult MoveFile([FromBody] RenameFileQuery query)
|
||||
{
|
||||
if (!ModelState.IsValid) return new BadRequestObjectResult(ModelState);
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var user = dbContext.Users.Single(
|
||||
u => u.Id == uid
|
||||
);
|
||||
|
|
@ -124,10 +122,10 @@ namespace Yavsc.ApiControllers
|
|||
if (!ModelState.IsValid) {
|
||||
var idvr = new ValidRemoteUserFilePathAttribute();
|
||||
|
||||
return this.HttpBadRequest(new { id = idvr.IsValid(query.id), to = idvr.IsValid(query.to), errors = ModelState });
|
||||
return this.BadRequest(new { id = idvr.IsValid(query.id), to = idvr.IsValid(query.to), errors = ModelState });
|
||||
}
|
||||
_logger.LogInformation($"Valid move query: {query.id} => {query.to}");
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var user = dbContext.Users.Single(
|
||||
u => u.Id == uid
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Attributes.Validation;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Messaging;
|
||||
using Yavsc.Services;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
|
|
@ -19,13 +16,16 @@ namespace Yavsc.ApiControllers
|
|||
{
|
||||
private readonly ILogger logger;
|
||||
private readonly ILiveProcessor liveProcessor;
|
||||
private readonly IHubContext<ChatHub> hubContext;
|
||||
readonly ApplicationDbContext dbContext;
|
||||
|
||||
public FileSystemStreamController(ApplicationDbContext context, ILiveProcessor liveProcessor, ILoggerFactory loggerFactory)
|
||||
public FileSystemStreamController(ApplicationDbContext context, ILiveProcessor liveProcessor, ILoggerFactory loggerFactory,
|
||||
IHubContext<ChatHub> hubContext)
|
||||
{
|
||||
this.dbContext = context;
|
||||
this.logger = loggerFactory.CreateLogger<FileSystemStreamController>();
|
||||
this.liveProcessor = liveProcessor;
|
||||
this.hubContext = hubContext;
|
||||
}
|
||||
|
||||
[Authorize, Route("put/{filename}")]
|
||||
|
|
@ -33,20 +33,20 @@ namespace Yavsc.ApiControllers
|
|||
{
|
||||
logger.LogInformation("Put : " + filename);
|
||||
if (!HttpContext.WebSockets.IsWebSocketRequest)
|
||||
return HttpBadRequest("not a web socket");
|
||||
return BadRequest("not a web socket");
|
||||
if (!HttpContext.User.Identity.IsAuthenticated)
|
||||
return new HttpUnauthorizedResult();
|
||||
return new UnauthorizedResult();
|
||||
var subdirs = filename.Split('/');
|
||||
var filePath = subdirs.Length > 1 ? string.Join("/", subdirs.Take(subdirs.Length-1)) : null;
|
||||
var shortFileName = subdirs[subdirs.Length-1];
|
||||
if (!shortFileName.IsValidShortFileName())
|
||||
{
|
||||
logger.LogInformation("invalid file name : " + filename);
|
||||
return HttpBadRequest("invalid file name");
|
||||
return BadRequest("invalid file name");
|
||||
}
|
||||
logger.LogInformation("validated: api/stream/Put: "+filename);
|
||||
var userName = User.GetUserName();
|
||||
var hubContext = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
|
||||
|
||||
string url = string.Format(
|
||||
"{0}/{1}/{2}",
|
||||
Startup.UserFilesOptions.RequestPath.ToUriComponent(),
|
||||
|
|
@ -54,7 +54,7 @@ namespace Yavsc.ApiControllers
|
|||
filename
|
||||
);
|
||||
|
||||
hubContext.Clients.All.addPublicStream(new PublicStreamInfo
|
||||
hubContext.Clients.All.SendAsync("addPublicStream", new PublicStreamInfo
|
||||
{
|
||||
sender = userName,
|
||||
url = url,
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using System.Security.Claims;
|
||||
using Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models.Blog;
|
||||
|
||||
[Produces("application/json")]
|
||||
|
|
@ -34,14 +35,14 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogTag postTag = _context.TagsDomain.Single(m => m.PostId == id);
|
||||
|
||||
if (postTag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(postTag);
|
||||
|
|
@ -53,12 +54,12 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != postTag.PostId)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(postTag).State = EntityState.Modified;
|
||||
|
|
@ -71,7 +72,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!PostTagExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -79,7 +80,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/PostTagsApi
|
||||
|
|
@ -88,7 +89,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.TagsDomain.Add(postTag);
|
||||
|
|
@ -100,7 +101,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (PostTagExists(postTag.PostId))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -117,13 +118,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogTag postTag = _context.TagsDomain.Single(m => m.PostId == id);
|
||||
if (postTag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.TagsDomain.Remove(postTag);
|
||||
|
|
@ -146,4 +147,4 @@ namespace Yavsc.Controllers
|
|||
return _context.TagsDomain.Count(e => e.PostId == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Data.Entity;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using System.Security.Claims;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models.Relationship;
|
||||
using Yavsc.Helpers;
|
||||
|
||||
[Produces("application/json")]
|
||||
[Route("api/TagsApi")]
|
||||
public class TagsApiController : Controller
|
||||
|
|
@ -37,14 +36,14 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Tag tag = _context.Tags.Single(m => m.Id == id);
|
||||
|
||||
if (tag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(tag);
|
||||
|
|
@ -56,12 +55,12 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != tag.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(tag).State = EntityState.Modified;
|
||||
|
|
@ -75,7 +74,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!TagExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -83,7 +82,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/TagsApi
|
||||
|
|
@ -92,7 +91,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Tags.Add(tag);
|
||||
|
|
@ -104,7 +103,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (TagExists(tag.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -121,13 +120,13 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Tag tag = _context.Tags.Single(m => m.Id == id);
|
||||
if (tag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Tags.Remove(tag);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue