code guidelines
This commit is contained in:
parent
58fb8cd530
commit
492427f4b8
82 changed files with 470 additions and 375 deletions
|
|
@ -16,7 +16,7 @@ namespace Yavsc.Controllers
|
|||
|
||||
public class BlogApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public BlogApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/blogtags")]
|
||||
public class BlogTagsApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public BlogTagsApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -144,4 +144,4 @@ namespace Yavsc.Controllers
|
|||
return _context.TagsDomain.Count(e => e.PostId == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/blogcomments")]
|
||||
public class CommentsApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public CommentsApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -158,4 +158,4 @@ namespace Yavsc.Controllers
|
|||
return _context.Comment.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ namespace Yavsc.ApiControllers
|
|||
[Authorize,Route("api/fs")]
|
||||
public partial class FileSystemApiController : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
private IAuthorizationService AuthorizationService;
|
||||
private ILogger _logger;
|
||||
readonly ApplicationDbContext dbContext;
|
||||
private readonly IAuthorizationService AuthorizationService;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public FileSystemApiController(ApplicationDbContext context,
|
||||
IAuthorizationService authorizationService,
|
||||
|
|
|
|||
|
|
@ -25,15 +25,15 @@ namespace Yavsc.ApiControllers
|
|||
[Route("api/bill"), Authorize]
|
||||
public class BillingController : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
private IStringLocalizer _localizer;
|
||||
private GoogleAuthSettings _googleSettings;
|
||||
private IYavscMessageSender _GCMSender;
|
||||
private IAuthorizationService authorizationService;
|
||||
readonly ApplicationDbContext dbContext;
|
||||
private readonly IStringLocalizer _localizer;
|
||||
private readonly GoogleAuthSettings _googleSettings;
|
||||
private readonly IYavscMessageSender _GCMSender;
|
||||
private readonly IAuthorizationService authorizationService;
|
||||
|
||||
|
||||
private ILogger logger;
|
||||
private IBillingService billingService;
|
||||
private readonly ILogger logger;
|
||||
private readonly IBillingService billingService;
|
||||
|
||||
public BillingController(
|
||||
IAuthorizationService authorizationService,
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ using Yavsc.Models.Billing;
|
|||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/estimate"),Authorize()]
|
||||
[Route("api/estimate"), Authorize()]
|
||||
public class EstimateApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private ILogger _logger;
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly ILogger _logger;
|
||||
public EstimateApiController(ApplicationDbContext context, ILoggerFactory loggerFactory)
|
||||
{
|
||||
_context = context;
|
||||
|
|
@ -28,21 +28,21 @@ namespace Yavsc.Controllers
|
|||
if (User.IsInRole(Constants.AdminGroupName)) return true;
|
||||
return uid == User.GetUserId();
|
||||
}
|
||||
bool UserIsAdminOrInThese (string oid, string uid)
|
||||
bool UserIsAdminOrInThese(string oid, string uid)
|
||||
{
|
||||
if (User.IsInRole(Constants.AdminGroupName)) return true;
|
||||
var cuid = User.GetUserId();
|
||||
return cuid == uid || cuid == oid;
|
||||
return cuid == uid || cuid == oid;
|
||||
}
|
||||
// GET: api/Estimate{?ownerId=User.GetUserId()}
|
||||
[HttpGet]
|
||||
public IActionResult GetEstimates(string ownerId=null)
|
||||
public IActionResult GetEstimates(string ownerId = null)
|
||||
{
|
||||
if ( ownerId == null ) ownerId = User.GetUserId();
|
||||
if (ownerId == null) ownerId = User.GetUserId();
|
||||
else if (!UserIsAdminOrThis(ownerId)) // throw new Exception("Not authorized") ;
|
||||
// or just do nothing
|
||||
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
return Ok(_context.Estimates.Include(e=>e.Bill).Where(e=>e.OwnerId == ownerId));
|
||||
// or just do nothing
|
||||
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
return Ok(_context.Estimates.Include(e => e.Bill).Where(e => e.OwnerId == ownerId));
|
||||
}
|
||||
// GET: api/Estimate/5
|
||||
[HttpGet("{id}", Name = "GetEstimate")]
|
||||
|
|
@ -53,20 +53,20 @@ namespace Yavsc.Controllers
|
|||
return HttpBadRequest(ModelState);
|
||||
}
|
||||
|
||||
Estimate estimate = _context.Estimates.Include(e=>e.Bill).Single(m => m.Id == id);
|
||||
Estimate estimate = _context.Estimates.Include(e => e.Bill).Single(m => m.Id == id);
|
||||
|
||||
if (estimate == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
if (UserIsAdminOrInThese(estimate.ClientId,estimate.OwnerId))
|
||||
return Ok(estimate);
|
||||
if (UserIsAdminOrInThese(estimate.ClientId, estimate.OwnerId))
|
||||
return Ok(estimate);
|
||||
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
}
|
||||
|
||||
// PUT: api/Estimate/5
|
||||
[HttpPut("{id}"),Produces("application/json")]
|
||||
[HttpPut("{id}"), Produces("application/json")]
|
||||
public IActionResult PutEstimate(long id, [FromBody] Estimate estimate)
|
||||
{
|
||||
|
||||
|
|
@ -84,11 +84,11 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (uid != estimate.OwnerId)
|
||||
{
|
||||
ModelState.AddModelError("OwnerId","You can only modify your own estimates");
|
||||
ModelState.AddModelError("OwnerId", "You can only modify your own estimates");
|
||||
return HttpBadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var entry = _context.Attach(estimate);
|
||||
try
|
||||
{
|
||||
|
|
@ -106,27 +106,30 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
return Ok( new { Id = estimate.Id });
|
||||
return Ok(new { estimate.Id });
|
||||
}
|
||||
|
||||
// POST: api/Estimate
|
||||
[HttpPost,Produces("application/json")]
|
||||
[HttpPost, Produces("application/json")]
|
||||
public IActionResult PostEstimate([FromBody] Estimate estimate)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
if (estimate.OwnerId==null) estimate.OwnerId = uid;
|
||||
|
||||
if (!User.IsInRole(Constants.AdminGroupName)) {
|
||||
if (estimate.OwnerId == null) estimate.OwnerId = uid;
|
||||
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
{
|
||||
if (uid != estimate.OwnerId)
|
||||
{
|
||||
ModelState.AddModelError("OwnerId","You can only create your own estimates");
|
||||
ModelState.AddModelError("OwnerId", "You can only create your own estimates");
|
||||
return HttpBadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
if (estimate.CommandId!=null) {
|
||||
|
||||
if (estimate.CommandId != null)
|
||||
{
|
||||
var query = _context.RdvQueries.FirstOrDefault(q => q.Id == estimate.CommandId);
|
||||
if (query == null) {
|
||||
if (query == null)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
}
|
||||
query.ValidationDate = DateTime.Now;
|
||||
|
|
@ -136,18 +139,18 @@ namespace Yavsc.Controllers
|
|||
if (!ModelState.IsValid)
|
||||
{
|
||||
_logger.LogError(JsonConvert.SerializeObject(ModelState));
|
||||
return Json(ModelState);
|
||||
return Json(ModelState);
|
||||
}
|
||||
_context.Estimates.Add(estimate);
|
||||
|
||||
|
||||
/* _context.AttachRange(estimate.Bill);
|
||||
_context.Attach(estimate);
|
||||
_context.Entry(estimate).State = EntityState.Added;
|
||||
foreach (var line in estimate.Bill)
|
||||
_context.Entry(line).State = EntityState.Added;
|
||||
// foreach (var l in estimate.Bill) _context.Attach<CommandLine>(l);
|
||||
*/
|
||||
|
||||
|
||||
/* _context.AttachRange(estimate.Bill);
|
||||
_context.Attach(estimate);
|
||||
_context.Entry(estimate).State = EntityState.Added;
|
||||
foreach (var line in estimate.Bill)
|
||||
_context.Entry(line).State = EntityState.Added;
|
||||
// foreach (var l in estimate.Bill) _context.Attach<CommandLine>(l);
|
||||
*/
|
||||
try
|
||||
{
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
|
|
@ -163,7 +166,7 @@ namespace Yavsc.Controllers
|
|||
throw;
|
||||
}
|
||||
}
|
||||
return Ok( new { Id = estimate.Id, Bill = estimate.Bill });
|
||||
return Ok(new { estimate.Id, estimate.Bill });
|
||||
}
|
||||
|
||||
// DELETE: api/Estimate/5
|
||||
|
|
@ -175,8 +178,8 @@ namespace Yavsc.Controllers
|
|||
return HttpBadRequest(ModelState);
|
||||
}
|
||||
|
||||
Estimate estimate = _context.Estimates.Include(e=>e.Bill).Single(m => m.Id == id);
|
||||
|
||||
Estimate estimate = _context.Estimates.Include(e => e.Bill).Single(m => m.Id == id);
|
||||
|
||||
if (estimate == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
|
|
@ -186,7 +189,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
if (uid != estimate.OwnerId)
|
||||
{
|
||||
ModelState.AddModelError("OwnerId","You can only create your own estimates");
|
||||
ModelState.AddModelError("OwnerId", "You can only create your own estimates");
|
||||
return HttpBadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
|
@ -195,8 +198,8 @@ namespace Yavsc.Controllers
|
|||
|
||||
return Ok(estimate);
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
|
|
@ -210,4 +213,4 @@ namespace Yavsc.Controllers
|
|||
return _context.Estimates.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ using Yavsc.ViewModels.FrontOffice;
|
|||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
[Route("api/front")]
|
||||
public class FrontOfficeApiController: Controller
|
||||
public class FrontOfficeApiController : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
|
||||
private IBillingService billing;
|
||||
|
||||
public FrontOfficeApiController(ApplicationDbContext context, IBillingService billing)
|
||||
|
|
@ -20,19 +21,19 @@ namespace Yavsc.ApiControllers
|
|||
this.billing = billing;
|
||||
}
|
||||
|
||||
[HttpGet("profiles/{actCode}")]
|
||||
IEnumerable<PerformerProfileViewModel> Profiles (string actCode)
|
||||
[HttpGet("profiles/{actCode}")]
|
||||
IEnumerable<PerformerProfileViewModel> Profiles(string actCode)
|
||||
{
|
||||
return dbContext.ListPerformers(billing, actCode);
|
||||
}
|
||||
|
||||
[HttpPost("query/reject")]
|
||||
public IActionResult RejectQuery (string billingCode, long queryId)
|
||||
public IActionResult RejectQuery(string billingCode, long queryId)
|
||||
{
|
||||
if (billingCode==null) return HttpBadRequest("billingCode");
|
||||
if (queryId==0) return HttpBadRequest("queryId");
|
||||
var billing = BillingService.GetBillable(dbContext, billingCode, queryId);
|
||||
if (billing==null) return HttpBadRequest();
|
||||
if (billingCode == null) return HttpBadRequest("billingCode");
|
||||
if (queryId == 0) return HttpBadRequest("queryId");
|
||||
var billing = BillingService.GetBillable(dbContext, billingCode, queryId);
|
||||
if (billing == null) return HttpBadRequest();
|
||||
billing.Rejected = true;
|
||||
billing.RejectedAt = DateTime.Now;
|
||||
dbContext.SaveChanges();
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ namespace Yavsc.ApiControllers
|
|||
[Route("api/payment")]
|
||||
public class PaymentApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext dbContext;
|
||||
private SiteSettings siteSettings;
|
||||
private readonly ApplicationDbContext dbContext;
|
||||
private readonly SiteSettings siteSettings;
|
||||
private readonly ILogger _logger;
|
||||
public PaymentApiController(
|
||||
ApplicationDbContext dbContext,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Yavsc.Controllers
|
|||
public class PerformersApiController : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
private IBillingService billing;
|
||||
private readonly IBillingService billing;
|
||||
|
||||
public PerformersApiController(ApplicationDbContext context, IBillingService billing)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/ProductApi")]
|
||||
public class ProductApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public ProductApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -146,4 +146,4 @@ namespace Yavsc.Controllers
|
|||
return _context.Products.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/dimiss")]
|
||||
public class DimissClicksApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public DimissClicksApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -174,4 +174,4 @@ namespace Yavsc.Controllers
|
|||
return _context.DimissClicked.Count(e => e.UserId == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Yavsc.Controllers
|
|||
[Authorize]
|
||||
public class FileCircleApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public FileCircleApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -185,4 +185,4 @@ namespace Yavsc.Controllers
|
|||
return _context.CircleAuthorizationToFile.Count(e => e.CircleId == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/bursherprofiles")]
|
||||
public class BursherProfilesApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public BursherProfilesApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,37 +26,12 @@ namespace Yavsc.ApiControllers
|
|||
[Route("api/haircut")]
|
||||
public class HairCutController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private IEmailSender _emailSender;
|
||||
private IYavscMessageSender _GCMSender;
|
||||
private GoogleAuthSettings _googleSettings;
|
||||
private IStringLocalizer<YavscLocalisation> _localizer;
|
||||
private ILogger _logger;
|
||||
private SiteSettings _siteSettings;
|
||||
private SmtpSettings _smtpSettings;
|
||||
private UserManager<ApplicationUser> _userManager;
|
||||
|
||||
PayPalSettings _paymentSettings;
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly ILogger _logger;
|
||||
public HairCutController(ApplicationDbContext context,
|
||||
IOptions<GoogleAuthSettings> googleSettings,
|
||||
IYavscMessageSender GCMSender,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> localizer,
|
||||
IEmailSender emailSender,
|
||||
IOptions<SmtpSettings> smtpSettings,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
IOptions<PayPalSettings> payPalSettings,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_context = context;
|
||||
_GCMSender = GCMSender;
|
||||
_emailSender = emailSender;
|
||||
_googleSettings = googleSettings.Value;
|
||||
_userManager = userManager;
|
||||
_smtpSettings = smtpSettings.Value;
|
||||
_siteSettings = siteSettings.Value;
|
||||
_paymentSettings = payPalSettings.Value;
|
||||
_localizer = localizer;
|
||||
_logger = loggerFactory.CreateLogger<HairCutController>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ namespace Yavsc.ApiControllers
|
|||
|
||||
public class DjProfileApiController : ProfileApiController<DjSettings>
|
||||
{
|
||||
public DjProfileApiController(ApplicationDbContext context) : base(context)
|
||||
public DjProfileApiController() : base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/museprefs")]
|
||||
public class MusicalPreferencesApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public MusicalPreferencesApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/MusicalTendenciesApi")]
|
||||
public class MusicalTendenciesApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public MusicalTendenciesApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -145,4 +145,4 @@ namespace Yavsc.Controllers
|
|||
return _context.MusicalTendency.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ using Yavsc.Models.Identity;
|
|||
[Authorize, Route("~/api/gcm")]
|
||||
public class NativeConfidentialController : Controller
|
||||
{
|
||||
ILogger _logger;
|
||||
ApplicationDbContext _context;
|
||||
readonly ILogger _logger;
|
||||
readonly ApplicationDbContext _context;
|
||||
|
||||
public NativeConfidentialController(ApplicationDbContext context,
|
||||
ILoggerFactory loggerFactory)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Yavsc.Controllers
|
|||
[Route("~/api/PostRateApi")]
|
||||
public class PostRateApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public PostRateApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,12 +9,9 @@ namespace Yavsc.ApiControllers
|
|||
/// </summary>
|
||||
[Produces("application/json"),Route("api/profile")]
|
||||
public abstract class ProfileApiController<T> : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
public ProfileApiController(ApplicationDbContext context)
|
||||
{ public ProfileApiController()
|
||||
{
|
||||
dbContext = context;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/blacklist"), Authorize]
|
||||
public class BlackListApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public BlackListApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -162,4 +162,4 @@ namespace Yavsc.Controllers
|
|||
return _context.BlackListed.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/blogacl")]
|
||||
public class BlogAclApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public BlogAclApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -164,4 +164,4 @@ namespace Yavsc.Controllers
|
|||
return _context.CircleAuthorizationToBlogPost.Count(e => e.CircleId == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ namespace Yavsc.Controllers
|
|||
[Route("api/chat")]
|
||||
public class ChatApiController : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
UserManager<ApplicationUser> userManager;
|
||||
private IConnexionManager _cxManager;
|
||||
readonly ApplicationDbContext dbContext;
|
||||
readonly UserManager<ApplicationUser> userManager;
|
||||
private readonly IConnexionManager _cxManager;
|
||||
public ChatApiController(ApplicationDbContext dbContext,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IConnexionManager cxManager)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/ChatRoomAccessApi")]
|
||||
public class ChatRoomAccessApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public ChatRoomAccessApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -183,4 +183,4 @@ namespace Yavsc.Controllers
|
|||
return _context.ChatRoomAccess.Count(e => e.ChannelName == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/ChatRoomApi")]
|
||||
public class ChatRoomApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public ChatRoomApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -164,4 +164,4 @@ namespace Yavsc.Controllers
|
|||
return _context.ChatRoom.Count(e => e.Name == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/cirle")]
|
||||
public class CircleApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public CircleApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -146,4 +146,4 @@ namespace Yavsc.Controllers
|
|||
return _context.Circle.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/ContactsApi")]
|
||||
public class ContactsApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public ContactsApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -125,4 +125,4 @@ namespace Yavsc.Controllers
|
|||
return _context.ClientProviderInfo.Count(e => e.UserId == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/ServiceApi")]
|
||||
public class ServiceApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public ServiceApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
@ -146,4 +146,4 @@ namespace Yavsc.Controllers
|
|||
return _context.Services.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,8 @@ namespace Yavsc.WebApi.Controllers
|
|||
|
||||
private UserManager<ApplicationUser> _userManager;
|
||||
private readonly SignInManager<ApplicationUser> _signInManager;
|
||||
|
||||
ApplicationDbContext _dbContext;
|
||||
private ILogger _logger;
|
||||
readonly ApplicationDbContext _dbContext;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public ApiAccountController(UserManager<ApplicationUser> userManager,
|
||||
SignInManager<ApplicationUser> signInManager, ILoggerFactory loggerFactory, ApplicationDbContext dbContext)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
|||
[Route("api/users")]
|
||||
public class ApplicationUserApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public ApplicationUserApiController(ApplicationDbContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ namespace Yavsc.ApiControllers.accounting
|
|||
[Route("~/api/profile")]
|
||||
public class ProfileApiController: Controller
|
||||
{
|
||||
UserManager<ApplicationUser> _userManager;
|
||||
ApplicationDbContext _dbContext;
|
||||
readonly UserManager<ApplicationUser> _userManager;
|
||||
readonly ApplicationDbContext _dbContext;
|
||||
public ProfileApiController(ApplicationDbContext dbContext, UserManager<ApplicationUser> userManager)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
|
|
@ -36,4 +36,4 @@ namespace Yavsc.ApiControllers.accounting
|
|||
.Take(10).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue