Помощь в написании студенческих работ
Антистрессовый сервис

Перелік джерел. 
Проектування та реалізація Web-сервісу для пошуку роботи

РефератПомощь в написанииУзнать стоимостьмоей работы

System.Diagnostics.CodeAnalysis.SuppressMessage («Microsoft.Design», «CA1063:ImplementIDisposableCorrectly»)]. System.Diagnostics.CodeAnalysis.SuppressMessage («Microsoft.Design», «CA1063:ImplementIDisposableCorrectly»)]. Public class ExtendedRoleStore: RoleStore, IQueryableRoleStore where TRole: ApplicationRole, new (). Public ApplicationController (DataProvider dataProvider, IHostingEnvironment… Читать ещё >

Перелік джерел. Проектування та реалізація Web-сервісу для пошуку роботи (реферат, курсовая, диплом, контрольная)

  • 1. Web-додаток «http://pomoshniki.ru/» [Електронний ресурс] / Learn — Codeacademy. Режим доступу: http://pomoshniki.ru/ - 10.05.2016 р. Загол. з екрану.
  • 2. Web-сервіс «www.kabanchik.ua» [Електронний ресурс] / Learn — Codeacademy. — Режим доступу: www.kabanchik.ua — 10.05.2016 р. Загол. з екрану.
  • 3. Бондарєв, В.М. «Об'єктно-орієнтовне програмування на C#»: навч. посіб. [Текст] / В.М. Бондарєв.- Х.:Компания СМІТ, 2009. 224 с.
  • 4. ASP.NET Site [Електронний ресурс] / ASP.NET MVC. — Режим доступу: http://www.asp.net/mvc — 10.05.2016 р. Загол. з екрану.
  • 5. Введення в програмування мовою Visual C# [Текст] / Гуріков С. Р. Форум, Інфра-М, 2013. — 448 c.
  • 6. Робінсон, С. C# для профессионалов [Текст] / С. Робінсон, М. Лори, О. Корнес, Д. Глинн — 2005. — 396 с.
  • 7. Бібліотека розробника MSDN [Електронний ресурс] / портал msdn.microsoft.com: Microsoft Developer Network. — Режим доступу: www/URL: http://msdn.microsoft.com/library/
  • 8. Принципи, паттерни і методики гнучкої розробки мовою C# [Текст] / Мартін Р. С., Мартін М. Символ-Плюс, 2011. — 768 c.
  • 9. Мак-Дональд, М. Microsoft ASP.NET 3.5 з прикладами на C# 2008.
  • 10. CLR via C# [Текст] / Jeffrey Richter. Microsoft Press, 2012. — 896 с.
  • 11. SQL: повний посібник [Текст] /. Грофф, Джеймс, Вайнберг Пол. Київ: BHV, 2005. — 608 c.
  • 12. Крєнке, Д. Теорія та практика побудови баз данных. 8-е вид. [Текст]: / Д. Крєнке. — СПб.: Питер, 2003. — 800 с.
  • 13. Програмування баз даних Microsoft SQL Server 2009 для професіоналів [Текст] / Вієйра Р. Діалектика, 2008. — 1072 c.
  • 14. UML [Электронный ресурс] / Вікіпедія — Режим доступу https://ru.wikipedia.org/wiki/UML/ - 31.05.2015 г. — Заголовок экрана.
  • 15. Myers, G. J. The Art of SoftwareTesting [Текст] / G. J. Myers. — John Wiley & Sons, Inc., Hoboken, New Jersey, Canada, 2004. — 255 c.

Додаток А

Фрагмент коду програми.

namespace Store.WebApi.Controllers.

{.

using Store.WebApi.ActionResults;

using Microsoft.AspNetCore.Mvc;

using Store.WebApi.Data;

using System;

using System. Linq;

using Extentions;

using Microsoft.ApplicationInsights.AspNetCore.Extensions;

using Microsoft.AspNetCore.Authorization;

using Microsoft.AspNetCore.Hosting;

//[RequireHttps].

public class ApplicationController: Store.WebApi.Controllers.ControllerBase.

{.

private readonly DataProvider dataProvider;

private readonly IHostingEnvironment hostingEnvironment;

public ApplicationController (DataProvider dataProvider, IHostingEnvironment hostingEnvironment).

{.

this.dataProvider = dataProvider;

this.hostingEnvironment = hostingEnvironment;

}.

[HttpGet].

[ResponseCache (CacheProfileName = «Caching», VaryByHeader = «Accept-Language»)].

public IActionResult List ().

{.

var applications = this.dataProvider.Applications.ToList ();

return this. Ok (applications);

}.

[ResponseCache (CacheProfileName = «Caching», VaryByHeader = «Accept-Language»)].

public IActionResult Info (string id).

{.

IActionResult result = null;

Guid guidId;

var application = Guid. TryParse (id, out guidId)? this.dataProvider.Applications.FirstOrDefault (c => c. Id == guidId): this.dataProvider.Applications.FirstOrDefault (c => c.SeoFriendlyName.Equals (id, StringComparison. OrdinalIgnoreCase));

if (application ≠ null).

{.

var requestUri = this.Request.GetUri ();

var shareLinks = application. GetShareLinks (requestUri);

application.ShareLinks = shareLinks;

result = this. Ok (application);

}.

else.

{.

result = this. NotFound (id);

}.

return result;

}.

[ResponseCache (CacheProfileName = «Caching», VaryByHeader = «Accept-Language»)].

public IActionResult Recommendations (string id).

{.

IActionResult result = null;

var apps = this.dataProvider.Applications.OrderByDescending (c => c. Likes).Take (3);

result = this. Ok (apps);

return result;

}.

[HttpGet].

[Authorize].

[ResponseCache (CacheProfileName = «NoCaching»)].

public IActionResult DownloadPackage (Guid id).

{.

IActionResult result;

var package = this.dataProvider.GetPackageById (id);

if (package ≠ null).

{.

var path = $" /wwwroot/{package.FileName}" ;

var fileInfo = this.hostingEnvironment.ContentRootFileProvider.GetFileInfo (path);

result = !fileInfo.Exists || fileInfo. IsDirectory? (IActionResult)this.NotFound (): new CustomFileContentResult (System.IO.File.ReadAllBytes (fileInfo.PhysicalPath), «application/octet-stream») { FileDownloadName = fileInfo.Name };

}.

else.

{.

result = this. NotFound (id.ToString ());

}.

return result;

}.

}.

}.

namespace Store.WebApi.Data.

{.

using Microsoft.Extensions.Logging;

using Store.WebApi.Core;

using NullGuard;

using System.Collections.Generic;

using Store.WebApi.Models;

using System;

using System. Linq;

using Store.WebApi.Extentions;

public class DataProvider.

{.

private readonly ILogger logger;

private Data data;

private readonly AppDataHelper appDataHelper;

public DataProvider (AppDataHelper appDataHelper, ILoggerFactory loggerFactory).

{.

this.logger = loggerFactory. CreateLogger ();

this.appDataHelper = appDataHelper;

this.Deserialize («datasource.xml»);

}.

public IReadOnlyCollection Applications => this.data.Applications.AsReadOnly ();

public IReadOnlyCollection Publishers => this.data.Publishers.AsReadOnly ();

publi StoreInfo GetStoreInfo ().

{.

return this.data.StoreInfo;

}.

[return: AllowNull].

public Package GetPackageById (Guid id).

{.

Package result = null;

foreach (var application in this.data.Applications).

{.

foreach (var applicationPackage in application. Packages).

{.

if (applicationPackage.Id == id).

{.

result = applicationPackage;

break;

}.

}.

if (reult ≠ null).

{.

break;

}.

}.

return result;

}.

public void Deserialize (string fileName).

{.

Data apps = null;

try.

{.

var xml = this.appDataHelper.ReadAllText (fileName);

apps = xml. XmlDeserializeFromString ();

foreach (var app in apps. Applications).

{.

var publisher = apps.Publishers.First (c => c. Id == app. PublisherId);

app.Publisher = publisher. PublisherDisplayName;

}.

}.

catch (Exception ex).

{.

this.logger.LogError (ex.Message);

}.

this.data = apps ?? new Data ();

}.

}.

}.

namespace EntityFrameworkDataService.Repositories.Implementations.

{.

using System.Data.Entity;

using Microsoft.AspNet.Identity;

using Microsoft.AspNet.Identity.EntityFramework;

using RFIDCardService.Models.Entities;

[System.Diagnostics.CodeAnalysis.SuppressMessage («Microsoft.Design», «CA1063:ImplementIDisposableCorrectly»)].

public class ExtendedRoleStore: RoleStore, IQueryableRoleStore where TRole: ApplicationRole, new ().

{.

public ExtendedRoleStore (DbContext context): base (context).

{.

}.

}.

}.

namespace EntityFrameworkDataService.Repositories.Implementations.

{.

using System.Data.Entity.Utilities;

using System;

using System.Collections.Generic;

using System. Linq;

using System.Threading.Tasks;

using System.Data.Entity;

using Microsoft.AspNet.Identity;

using Microsoft.AspNet.Identity.EntityFramework;

using RFIDCardService.Models.Entities;

[System.Diagnostics.CodeAnalysis.SuppressMessage («Microsoft.Design», «CA1063:ImplementIDisposableCorrectly»)].

public class ExtendedUserStore: UserStore, IUserStore where TUser: User.

{.

private readonly DbContext context;

public ExtendedUserStore (DbContext context): base (context).

{.

this.context = context;

}.

/// Get the names of the roles a user is a member of.

public override async Task GetRolesAsync (TUser user).

{.

var userRoles = this.context.Set ();

var roles = this.context.Set ();

if (user == null).

{.

throw new ArgumentNullException (nameof (user));

}.

//нужно для управления правами.

short tenantId = TenantEx. GetTenantId ();

var userId = user. Id;

var query = from userRole in userRoles.

join role in roles on userRole. RoleId equals role.Id.

where userRole.UserId.Equals (userId) && userRole.TenantId.Equals (tenantId).

select role.Name;

return await query. ToListAsync ();

}.

/// Returns true if the user is in the named role.

public override async Task IsInRoleAsync (TUser user, string roleName).

{.

if (user == null).

{.

throw new ArgumentNullException (nameof (user));

}.

if (string.IsNullOrWhiteSpace (roleName)).

{.

throw new ArgumentNullException (nameof (roleName));

}.

var userRoles = this.context.Set ();

var roles = this.context.Set ();

var role = await roles. SingleOrDefaultAsync (r => r.Name.ToUpper () == roleName. ToUpper ());

if (role ≠ null).

{.

var userId = user. Id;

var roleId = role. Id;

return await userRoles. AnyAsync (ur => ur.RoleId.Equals (roleId) && ur.UserId.Equals (userId) && ur. TenantId == user. CurrentTenantId);

}.

return false;

}.

/// Remove a user from a role.

public override async Task RemoveFromRoleAsync (TUser user, string roleName).

{.

if (user == null).

{.

throw new ArgumentNullException (nameof (user));

}.

if (string.IsNullOrWhiteSpace (roleName)).

{.

throw new ArgumentException (nameof (roleName));

}.

var roles = this.context.Set ();

var roleEntity = await roles. SingleOrDefaultAsync (r => r.Name.ToUpper () == roleName. ToUpper ()).WithCurrentCulture ();

if (roleEntity ≠ null).

{.

var roleId = roleEntity. Id;

var userId = user. Id;

var userRoles = this.context.Set ();

var tenantId = TenantEx. GetTenantId ();

var userRole = await userRoles. FirstOrDefaultAsync (r => roleId. Equals (r.RoleId) && r.UserId.Equals (userId) && r. TenantId == tenantId).WithCurrentCulture ();

if (userRole ≠ null).

{.

userRoles.Remove (userRole);

}.

}.

}.

/// Add a user to a role.

public override async Task AddToRoleAsync (TUser user, string roleName).

{.

if (user == null).

{.

throw new ArgumentNullException (nameof (user));

}.

if (string.IsNullOrWhiteSpace (roleName)).

{.

throw new ArgumentNullException (nameof (roleName));

}.

var roles = this.context.Set ();

Показать весь текст
Заполнить форму текущей работой