diff --git a/AppServices/AppServices.csproj b/AppServices/AppServices.csproj
index 6d831f8..fa377a8 100644
--- a/AppServices/AppServices.csproj
+++ b/AppServices/AppServices.csproj
@@ -20,5 +20,9 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/AppServices/Data/Extensions/QueryableExtensions.cs b/AppServices/Data/Extensions/QueryableExtensions.cs
index f88e4d0..a0dd403 100644
--- a/AppServices/Data/Extensions/QueryableExtensions.cs
+++ b/AppServices/Data/Extensions/QueryableExtensions.cs
@@ -25,7 +25,6 @@ public static IQueryable FullTextSearch(this IQueryable queryable, stri
return FullTextSearch(queryable, searchKey, false);
}
-
///
/// Searches in all string properties for the specifed search key.
/// It is also able to search for several words. If the searchKey is for example 'John Travolta' then
@@ -45,7 +44,6 @@ public static IQueryable FullTextSearch(this IQueryable queryable, stri
var indexOfMethod = typeof(string).GetMethod("IndexOf", new[] { typeof(string), typeof(StringComparison) });
-
var publicProperties = typeof(T)
.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
.Where(p => p.PropertyType == typeof(string));
@@ -79,8 +77,8 @@ private static IOrderedQueryable OrderingHelper(IQueryable source, stri
ParameterExpression param = Expression.Parameter(typeof(T), string.Empty);
#region Sort by sub properties
- //This part is what sorts by sub properties
- //For example: Manufacturer.Name
+ // This part is what sorts by sub properties
+ // For example: Manufacturer.Name
var parts = propertyName.Split('.');
Expression parent = param;
@@ -102,18 +100,22 @@ private static IOrderedQueryable OrderingHelper(IQueryable source, stri
return (IOrderedQueryable)source.Provider.CreateQuery(call);
}
+
public static IOrderedQueryable OrderBy(this IQueryable source, string propertyName)
{
return OrderingHelper(source, propertyName, false, false);
}
+
public static IOrderedQueryable OrderByDescending(this IQueryable source, string propertyName)
{
return OrderingHelper(source, propertyName, true, false);
}
+
public static IOrderedQueryable ThenBy(this IOrderedQueryable source, string propertyName)
{
return OrderingHelper(source, propertyName, false, true);
}
+
public static IOrderedQueryable ThenByDescending(this IOrderedQueryable source, string propertyName)
{
return OrderingHelper(source, propertyName, true, true);
diff --git a/AppServices/Data/Repositories/BaseRepository.cs b/AppServices/Data/Repositories/BaseRepository.cs
index 3a33ed3..3686949 100644
--- a/AppServices/Data/Repositories/BaseRepository.cs
+++ b/AppServices/Data/Repositories/BaseRepository.cs
@@ -103,6 +103,7 @@ public virtual T Update(T entity, int id)
entry.State = EntityState.Modified;
}
}
+
return entity;
}
diff --git a/AppServices/Data/Repositories/UsersRepository.cs b/AppServices/Data/Repositories/UsersRepository.cs
index 83bd1a3..913728c 100644
--- a/AppServices/Data/Repositories/UsersRepository.cs
+++ b/AppServices/Data/Repositories/UsersRepository.cs
@@ -10,5 +10,5 @@ public UsersRepository(EmpleaDbContext database) : base(database)
}
}
- public interface IUsersRepository: IBaseRepository { }
+ public interface IUsersRepository : IBaseRepository { }
}
diff --git a/AppServices/Data/TableConfigurations/TableConfiguration.cs b/AppServices/Data/TableConfigurations/TableConfiguration.cs
index 3cb2463..ccfad3e 100644
--- a/AppServices/Data/TableConfigurations/TableConfiguration.cs
+++ b/AppServices/Data/TableConfigurations/TableConfiguration.cs
@@ -15,6 +15,7 @@ protected void CommonColumnsConfiguration(EntityTypeBuilder builder)
builder.Property(p => p.CreatedAt).IsRequired();
builder.Property(p => p.IsActive).IsRequired();
}
+
public abstract void Configure(EntityTypeBuilder builder);
}
}
diff --git a/AppServices/Framework/TaskResult.cs b/AppServices/Framework/TaskResult.cs
index 888bb5a..f76040a 100644
--- a/AppServices/Framework/TaskResult.cs
+++ b/AppServices/Framework/TaskResult.cs
@@ -17,7 +17,6 @@ public TaskResult()
_messages = new List();
}
-
public void AddErrorMessage(string message)
{
_success = false;
diff --git a/AppServices/Services/BaseService.cs b/AppServices/Services/BaseService.cs
index 0813a2a..2543d5d 100644
--- a/AppServices/Services/BaseService.cs
+++ b/AppServices/Services/BaseService.cs
@@ -31,16 +31,17 @@ public TaskResult Create(T entity)
_mainRepository.CommitChanges();
taskResult.AddMessage("Registro agregado exitosamente");
}
- catch(Exception ex)
+ catch (Exception ex)
{
taskResult.AddErrorMessage(ex.Message);
- if(ex.InnerException != null)
+ if (ex.InnerException != null)
taskResult.AddErrorMessage(ex.InnerException.Message);
-
}
}
+
return taskResult;
}
+
public TaskResult Update(T entity)
{
var taskResult = ValidateOnUpdate(entity);
@@ -60,6 +61,7 @@ public TaskResult Update(T entity)
taskResult.AddErrorMessage(ex.InnerException.Message);
}
}
+
return taskResult;
}
@@ -82,15 +84,17 @@ public TaskResult Delete(T entity)
taskResult.AddErrorMessage(ex.InnerException.Message);
}
}
+
return taskResult;
}
+
public virtual List GetAll()
{
return _mainRepository.Get(x => x.IsActive).ToList();
}
}
- public interface IBaseService where T:Entity where U:IBaseRepository
+ public interface IBaseService where T : Entity where U : IBaseRepository
{
List GetAll();
TaskResult Create(T entity);
diff --git a/AppServices/Services/CategoriesService.cs b/AppServices/Services/CategoriesService.cs
index 4f1c1a0..a7c30b2 100644
--- a/AppServices/Services/CategoriesService.cs
+++ b/AppServices/Services/CategoriesService.cs
@@ -29,6 +29,5 @@ protected override TaskResult ValidateOnUpdate(Category entity)
public interface ICategoriesService : IBaseService
{
-
}
}
diff --git a/AppServices/Services/CompaniesService.cs b/AppServices/Services/CompaniesService.cs
index 59481c6..6344980 100644
--- a/AppServices/Services/CompaniesService.cs
+++ b/AppServices/Services/CompaniesService.cs
@@ -16,12 +16,12 @@ public CompaniesService(ICompaniesRepository mainRepository) : base(mainReposito
public List GetByUserId(int userId)
{
- return _mainRepository.Get(x=>x.IsActive && x.UserId == userId).ToList();
+ return _mainRepository.Get(x => x.IsActive && x.UserId == userId).ToList();
}
- public Company GetById(int id)
+ public Company GetById(int id)
{
- return _mainRepository.Get(x=>x.IsActive && x.Id == id).FirstOrDefault();
+ return _mainRepository.Get(x => x.IsActive && x.Id == id).FirstOrDefault();
}
protected override TaskResult ValidateOnCreate(Company entity)
@@ -43,6 +43,6 @@ protected override TaskResult ValidateOnUpdate(Company entity)
public interface ICompaniesService : IBaseService
{
List GetByUserId(int userId);
- Company GetById(int id);
+ Company GetById(int id);
}
}
diff --git a/AppServices/Services/HireTypesService.cs b/AppServices/Services/HireTypesService.cs
index 78f2f31..d712557 100644
--- a/AppServices/Services/HireTypesService.cs
+++ b/AppServices/Services/HireTypesService.cs
@@ -29,6 +29,5 @@ protected override TaskResult ValidateOnUpdate(HireType entity)
public interface IHireTypesService : IBaseService
{
-
}
}
diff --git a/AppServices/Services/LocationsService.cs b/AppServices/Services/LocationsService.cs
index 912c2b8..bf0a0c8 100644
--- a/AppServices/Services/LocationsService.cs
+++ b/AppServices/Services/LocationsService.cs
@@ -29,6 +29,5 @@ protected override TaskResult ValidateOnUpdate(Location entity)
public interface ILocationsService : IBaseService
{
-
}
}
diff --git a/AppServices/Services/LoginsService.cs b/AppServices/Services/LoginsService.cs
index ac39cde..ec3a669 100644
--- a/AppServices/Services/LoginsService.cs
+++ b/AppServices/Services/LoginsService.cs
@@ -14,7 +14,7 @@ public LoginsService(ILoginsRepository mainRepository) : base(mainRepository)
public Login GetLogin(string provider, string socialId)
{
- return _mainRepository.Get(x=>x.ProviderKey== socialId && x.LoginProvider == provider).FirstOrDefault();
+ return _mainRepository.Get(x => x.ProviderKey == socialId && x.LoginProvider == provider).FirstOrDefault();
}
protected override TaskResult ValidateOnCreate(Login entity)
diff --git a/AppServices/Services/TwitterService.cs b/AppServices/Services/TwitterService.cs
index 9d47d40..e05bcc7 100644
--- a/AppServices/Services/TwitterService.cs
+++ b/AppServices/Services/TwitterService.cs
@@ -9,7 +9,7 @@
///
/// Simple class for sending tweets to Twitter using Single-user OAuth.
/// https://dev.twitter.com/oauth/overview/single-user
-///
+///
/// Get your access keys by creating an app at apps.twitter.com then visiting the
/// "Keys and Access Tokens" section for your app. They can be found under the
/// "Your Access Token" heading.
@@ -23,18 +23,18 @@ public class TwitterService : ITwitterService
readonly string consumerKey, consumerKeySecret, accessToken, accessTokenSecret;
readonly HMACSHA1 sigHasher;
readonly DateTime epochUtc = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
- //readonly IOptions appSettings;
+ // readonly IOptions appSettings;
///
/// Creates an object for sending tweets to Twitter using Single-user OAuth.
- ///
+ ///
/// Get your access keys by creating an app at apps.twitter.com then visiting the
/// "Keys and Access Tokens" section for your app. They can be found under the
/// "Your Access Token" heading.
///
public TwitterService(IOptions app)
{
- //validateConfig(app);
+ // validateConfig(app);
this.consumerKey = app.Value.consumerKey;
this.consumerKeySecret = app.Value.consumerKeySecret;
this.accessToken = app.Value.accessToken;
@@ -61,7 +61,7 @@ Task SendRequest(string url, Dictionary data)
var fullUrl = TwitterApiBaseUrl + url;
// Timestamps are in seconds since 1/1/1970.
- var timestamp = (int)((DateTime.UtcNow - epochUtc).TotalSeconds);
+ var timestamp = (int)(DateTime.UtcNow - epochUtc).TotalSeconds;
// Add all the OAuth headers we'll need to use when constructing the hash.
data.Add("oauth_consumer_key", consumerKey);
@@ -93,15 +93,13 @@ string GenerateSignature(string url, Dictionary data)
data
.Union(data)
.Select(kvp => string.Format("{0}={1}", Uri.EscapeDataString(kvp.Key), Uri.EscapeDataString(kvp.Value)))
- .OrderBy(s => s)
- );
+ .OrderBy(s => s));
var fullSigData = string.Format(
"{0}&{1}&{2}",
"POST",
Uri.EscapeDataString(url),
- Uri.EscapeDataString(sigString.ToString())
- );
+ Uri.EscapeDataString(sigString.ToString()));
return Convert.ToBase64String(sigHasher.ComputeHash(new System.Text.ASCIIEncoding().GetBytes(fullSigData.ToString())));
}
@@ -116,8 +114,7 @@ string GenerateOAuthHeader(Dictionary data)
data
.Where(kvp => kvp.Key.StartsWith("oauth_"))
.Select(kvp => string.Format("{0}=\"{1}\"", Uri.EscapeDataString(kvp.Key), Uri.EscapeDataString(kvp.Value)))
- .OrderBy(s => s)
- );
+ .OrderBy(s => s));
}
///
@@ -138,21 +135,21 @@ async Task SendRequest(string fullUrl, string oAuthHeader, FormUrlEncode
void validateConfig(IOptions app)
{
- if(String.IsNullOrEmpty(app.Value.consumerKey)||String.IsNullOrEmpty(app.Value.consumerKeySecret) || String.IsNullOrEmpty(app.Value.accessToken) || String.IsNullOrEmpty(app.Value.accessTokenSecret))
+ if (string.IsNullOrEmpty(app.Value.consumerKey) || string.IsNullOrEmpty(app.Value.consumerKeySecret) || string.IsNullOrEmpty(app.Value.accessToken) || string.IsNullOrEmpty(app.Value.accessTokenSecret))
throw new ArgumentException("Twitter configuration setting are required");
}
}
+
public interface ITwitterService
{
Task Tweet(string text);
-
}
+
public class TwitterConfig
{
public string consumerKey { get; set; }
public string consumerKeySecret { get; set; }
public string accessToken { get; set; }
public string accessTokenSecret { get; set; }
-
}
}
\ No newline at end of file
diff --git a/AppServices/Services/UsersService.cs b/AppServices/Services/UsersService.cs
index 267ce6b..d8b6d57 100644
--- a/AppServices/Services/UsersService.cs
+++ b/AppServices/Services/UsersService.cs
@@ -29,6 +29,5 @@ protected override TaskResult ValidateOnUpdate(User entity)
public interface IUsersService : IBaseService
{
-
}
}
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..e666873
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,9 @@
+
+
+
+ $(SolutionDir)StyleCop.ruleset
+
+
+
+
+
diff --git a/Domain/Domain.csproj b/Domain/Domain.csproj
index b71c5c5..120011d 100644
--- a/Domain/Domain.csproj
+++ b/Domain/Domain.csproj
@@ -14,4 +14,10 @@
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
diff --git a/Domain/Entities/Company.cs b/Domain/Entities/Company.cs
index a09a985..1f49f0e 100644
--- a/Domain/Entities/Company.cs
+++ b/Domain/Entities/Company.cs
@@ -1,6 +1,5 @@
using System;
namespace Domain.Entities
-
{
public class Company : Entity
{
diff --git a/Domain/Entities/Entity.cs b/Domain/Entities/Entity.cs
index f53b601..6ff54b8 100644
--- a/Domain/Entities/Entity.cs
+++ b/Domain/Entities/Entity.cs
@@ -1,6 +1,5 @@
using System;
namespace Domain.Entities
-
{
public class Entity
{
diff --git a/Domain/Entities/HireType.cs b/Domain/Entities/HireType.cs
index f2baaf1..669ff8c 100644
--- a/Domain/Entities/HireType.cs
+++ b/Domain/Entities/HireType.cs
@@ -1,6 +1,5 @@
using System;
namespace Domain.Entities
-
{
public class HireType : Entity
{
diff --git a/Domain/Entities/Job.cs b/Domain/Entities/Job.cs
index c2c0450..04ac03c 100644
--- a/Domain/Entities/Job.cs
+++ b/Domain/Entities/Job.cs
@@ -3,7 +3,6 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Domain.Entities
-
{
public class Job : Entity
{
@@ -15,7 +14,7 @@ public class Job : Entity
public int ViewCount { get; set; }
- public int Likes { get; set; } = 0;
+ public int Likes { get; set; } = 0;
public bool IsRemote { get; set; } = false;
@@ -25,7 +24,6 @@ public class Job : Entity
public DateTime PublishedDate { get; set; }
-
// Relationships with other entities
public int CategoryId { get; set; }
@@ -45,8 +43,5 @@ public class Job : Entity
public int? UserId { get; set; }
public virtual User User { get; set; }
-
-
-
}
}
diff --git a/Domain/Entities/JoelTest.cs b/Domain/Entities/JoelTest.cs
index fd26a1e..e89b398 100644
--- a/Domain/Entities/JoelTest.cs
+++ b/Domain/Entities/JoelTest.cs
@@ -1,6 +1,5 @@
using System;
namespace Domain.Entities
-
{
public class JoelTest : Entity
{
diff --git a/Domain/Entities/Location.cs b/Domain/Entities/Location.cs
index 2479640..72a1fe4 100644
--- a/Domain/Entities/Location.cs
+++ b/Domain/Entities/Location.cs
@@ -1,6 +1,5 @@
using System;
namespace Domain.Entities
-
{
public class Location : Entity
{
diff --git a/Domain/Entities/Login.cs b/Domain/Entities/Login.cs
index 917d2a8..34a60ec 100644
--- a/Domain/Entities/Login.cs
+++ b/Domain/Entities/Login.cs
@@ -1,6 +1,5 @@
using System;
namespace Domain.Entities
-
{
public class Login : Entity
{
diff --git a/Domain/Entities/Permission.cs b/Domain/Entities/Permission.cs
index 155c194..c21b3ae 100644
--- a/Domain/Entities/Permission.cs
+++ b/Domain/Entities/Permission.cs
@@ -1,6 +1,5 @@
using System;
namespace Domain.Entities
-
{
public class Permission : Entity
{
diff --git a/Domain/Entities/Role.cs b/Domain/Entities/Role.cs
index 0ab6c2d..2ac8374 100644
--- a/Domain/Entities/Role.cs
+++ b/Domain/Entities/Role.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
namespace Domain.Entities
-
{
public class Role : Entity
{
diff --git a/Domain/Entities/User.cs b/Domain/Entities/User.cs
index c4844c8..f6d7bc0 100644
--- a/Domain/Entities/User.cs
+++ b/Domain/Entities/User.cs
@@ -2,11 +2,10 @@
using System.Collections.Generic;
namespace Domain.Entities
-
{
public class User : Entity
{
- //public string LegacyId { get; set; }
+ // public string LegacyId { get; set; }
public string Email { get; set; }
diff --git a/Domain/Framework/Constants/ConfigurationFlags.cs b/Domain/Framework/Constants/ConfigurationFlags.cs
index d4c3d83..af04704 100644
--- a/Domain/Framework/Constants/ConfigurationFlags.cs
+++ b/Domain/Framework/Constants/ConfigurationFlags.cs
@@ -4,6 +4,7 @@ public static class LegacyApiClient
{
public static readonly string PageSize = "LegacyApiClient:PageSize";
}
+
public static class HomeController
{
public static readonly string RecentJobCount = "HomeController:RecenJobCount";
diff --git a/Domain/Framework/Constants/FeatureFlags.cs b/Domain/Framework/Constants/FeatureFlags.cs
index 2a57080..fca4fb8 100644
--- a/Domain/Framework/Constants/FeatureFlags.cs
+++ b/Domain/Framework/Constants/FeatureFlags.cs
@@ -9,7 +9,6 @@ public static class FeatureFlags
public static readonly string EnableApplyForJob = "jobscontroller-enable-apply-for-job";
public static readonly string ShowPreviewWarning = "jobscontroller-show-preview-warning";
public static readonly string AllowBookmarking = "jobscontroller-allow-bookmarking";
-
public static class LegacyClient
{
diff --git a/Domain/Framework/LoginResult.cs b/Domain/Framework/LoginResult.cs
index ff76585..3fe32a7 100644
--- a/Domain/Framework/LoginResult.cs
+++ b/Domain/Framework/LoginResult.cs
@@ -24,10 +24,12 @@ public string Message
AddErrorMessage(Exception.InnerException.ToString());
}
}
+
if (Messages.Count == 1)
{
return Messages[0];
}
+
if (Messages.Count > 0)
{
result = string.Join(",", Messages);
@@ -38,6 +40,7 @@ public string Message
{
result = "";
}
+
return result;
}
}
@@ -51,6 +54,7 @@ public void AddErrorMessage(string errorMessage)
ExecutedSuccesfully = false;
Messages.Add(errorMessage);
}
+
public void AddMessage(string message)
{
Messages.Add(message);
diff --git a/Empleado.sln b/Empleado.sln
index e21da2a..62403b4 100644
--- a/Empleado.sln
+++ b/Empleado.sln
@@ -1,12 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30128.74
+MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "Domain\Domain.csproj", "{1D0CA49A-07B9-47AB-A48D-413B26320652}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppServices", "AppServices\AppServices.csproj", "{00998967-9074-45CE-9264-CE8A2A98B372}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migrations", "Migrations\Migrations.csproj", "{AAED3C8C-0CD2-4199-8EBA-5BEFD09EDA32}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web", "Web\Web.csproj", "{48C1513F-6C78-4699-A5EA-13117AF6BEC8}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Web", "Web\Web.csproj", "{48C1513F-6C78-4699-A5EA-13117AF6BEC8}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F72AA92A-BF44-49B0-BCF5-EE644BE1C1B6}"
+ ProjectSection(SolutionItems) = preProject
+ Directory.Build.props = Directory.Build.props
+ StyleCop.ruleset = StyleCop.ruleset
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -31,4 +39,10 @@ Global
{48C1513F-6C78-4699-A5EA-13117AF6BEC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48C1513F-6C78-4699-A5EA-13117AF6BEC8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {60417AB1-425D-4259-90CD-BC7302D628A8}
+ EndGlobalSection
EndGlobal
diff --git a/Migrations/201909022107_adding_users_table.cs b/Migrations/201909022107_adding_users_table.cs
index 52afad3..44ce391 100644
--- a/Migrations/201909022107_adding_users_table.cs
+++ b/Migrations/201909022107_adding_users_table.cs
@@ -19,7 +19,6 @@ public override void Up()
.WithCommonColumns()
.WithColumn("Name").AsString().NotNullable()
.WithColumn("Email").AsString().NotNullable();
-
}
}
}
diff --git a/Migrations/201909062108_adding_role_tbl.cs b/Migrations/201909062108_adding_role_tbl.cs
index 0c01073..d48b130 100644
--- a/Migrations/201909062108_adding_role_tbl.cs
+++ b/Migrations/201909062108_adding_role_tbl.cs
@@ -4,7 +4,6 @@
namespace Migrations
{
-
[Migration(20190906108)]
public class _20190906108_adding_role_tbl : Migration
{
@@ -21,6 +20,3 @@ public override void Up()
}
}
}
-
-
-
diff --git a/Migrations/201909062110_adding_login_tbl.cs b/Migrations/201909062110_adding_login_tbl.cs
index d97b8d0..fcdcddc 100644
--- a/Migrations/201909062110_adding_login_tbl.cs
+++ b/Migrations/201909062110_adding_login_tbl.cs
@@ -21,4 +21,3 @@ public override void Up()
}
}
}
-
diff --git a/Migrations/201909062111_adding_location_tbl.cs b/Migrations/201909062111_adding_location_tbl.cs
index 958e6d6..bdaf34a 100644
--- a/Migrations/201909062111_adding_location_tbl.cs
+++ b/Migrations/201909062111_adding_location_tbl.cs
@@ -20,7 +20,6 @@ public override void Up()
.WithColumn("Name").AsString().NotNullable()
.WithColumn("Latitude").AsString().NotNullable()
.WithColumn("Longitude").AsString().NotNullable();
-
}
}
}
diff --git a/Migrations/201909062112_adding_joelTest_tbl.cs b/Migrations/201909062112_adding_joelTest_tbl.cs
index fedebd9..3efd625 100644
--- a/Migrations/201909062112_adding_joelTest_tbl.cs
+++ b/Migrations/201909062112_adding_joelTest_tbl.cs
@@ -28,7 +28,6 @@ public override void Up()
.WithColumn("HasTesters").AsBoolean().NotNullable()
.WithColumn("HasWrittenTest").AsBoolean().NotNullable()
.WithColumn("HasHallwayTests").AsBoolean().NotNullable();
-
}
}
}
diff --git a/Migrations/201909062113_adding_job_tbl.cs b/Migrations/201909062113_adding_job_tbl.cs
index 2ab8059..a953f00 100644
--- a/Migrations/201909062113_adding_job_tbl.cs
+++ b/Migrations/201909062113_adding_job_tbl.cs
@@ -31,8 +31,6 @@ public override void Up()
.WithColumn("HireTypeId").AsInt32().NotNullable()
.WithColumn("JoelTestId").AsInt32().Nullable()
.WithColumn("LocationId").AsInt32().Nullable();
-
}
}
}
-
diff --git a/Migrations/201909090017_inserting_category_and_hiretype_data.cs b/Migrations/201909090017_inserting_category_and_hiretype_data.cs
index 37e39d4..746a3a0 100644
--- a/Migrations/201909090017_inserting_category_and_hiretype_data.cs
+++ b/Migrations/201909090017_inserting_category_and_hiretype_data.cs
@@ -15,7 +15,7 @@ public override void Down()
public override void Up()
{
Insert.IntoTable(TableConstants.Categories).WithIdentityInsert()
- .Row(new { id = 1, Name = "Diseño Gráfico", Description="", IsActive = true, CreatedAt = DateTime.UtcNow })
+ .Row(new { id = 1, Name = "Diseño Gráfico", Description = "", IsActive = true, CreatedAt = DateTime.UtcNow })
.Row(new { id = 2, Name = "Desarrollo Web", Description = "", IsActive = true, CreatedAt = DateTime.UtcNow })
.Row(new { id = 3, Name = "Desarrollo para Móviles", Description = "", IsActive = true, CreatedAt = DateTime.UtcNow })
.Row(new { id = 4, Name = "Desarrollo de Software", Description = "", IsActive = true, CreatedAt = DateTime.UtcNow })
diff --git a/Migrations/201909090134_inserting_dummy_job_data.cs b/Migrations/201909090134_inserting_dummy_job_data.cs
index 3f1e758..434a965 100644
--- a/Migrations/201909090134_inserting_dummy_job_data.cs
+++ b/Migrations/201909090134_inserting_dummy_job_data.cs
@@ -19,17 +19,19 @@ public override void Up()
.Row(new { Id = -1, Name = "Claudio", Email = "claudio@megsoftconsulting.com" });
Insert.IntoTable(TableConstants.Companies).WithIdentityInsert()
- .Row(new {
- Id= -1,
- Name = "Megsoft",
- CreatedAt= DateTime.UtcNow,
+ .Row(new
+ {
+ Id = -1,
+ Name = "Megsoft",
+ CreatedAt = DateTime.UtcNow,
Email = "claudio@megsoftconsulting.com",
- Url ="https://megsoftconsulting.com",
- LogoUrl= "https://megsoftconsulting.com/wp-content/uploads/2018/08/my_business.png",
- UserId =-1});
+ Url = "https://megsoftconsulting.com",
+ LogoUrl = "https://megsoftconsulting.com/wp-content/uploads/2018/08/my_business.png",
+ UserId = -1
+ });
Insert.IntoTable(TableConstants.Jobs).WithIdentityInsert()
- .Row(new
+ .Row(new
{
Id = -1,
Title = "Web Developer wanted",
@@ -40,13 +42,12 @@ public override void Up()
CategoryId = 1,
HireTypeId = 1,
HowToApply = "just apply",
- IsRemote = true,
- CompanyId= -1,
+ IsRemote = true,
+ CompanyId = -1,
ViewCount = 0,
Likes = 0,
PublishedDate = DateTime.UtcNow,
- UserId= -1
-
+ UserId = -1
})
.Row(new
{
@@ -65,9 +66,7 @@ public override void Up()
Likes = 0,
PublishedDate = DateTime.UtcNow,
UserId = -1
-
- }
- );
+ });
}
}
}
\ No newline at end of file
diff --git a/Migrations/Framework/MigrationExtensions.cs b/Migrations/Framework/MigrationExtensions.cs
index a296ed6..8989d3a 100644
--- a/Migrations/Framework/MigrationExtensions.cs
+++ b/Migrations/Framework/MigrationExtensions.cs
@@ -25,6 +25,5 @@ public static ICreateTableColumnOptionOrWithColumnSyntax WithCommonColumns(this
.WithColumn("CreatedAt").AsDateTime().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime)
.WithColumn("UpdatedAt").AsDateTime().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime);
}
-
}
}
diff --git a/Migrations/Migrations.csproj b/Migrations/Migrations.csproj
index 41369d5..6bcf17d 100644
--- a/Migrations/Migrations.csproj
+++ b/Migrations/Migrations.csproj
@@ -11,6 +11,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/StyleCop.ruleset b/StyleCop.ruleset
new file mode 100644
index 0000000..9fb022b
--- /dev/null
+++ b/StyleCop.ruleset
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Web/Controllers/AccountController.cs b/Web/Controllers/AccountController.cs
index d77f3f7..b0cc8d2 100644
--- a/Web/Controllers/AccountController.cs
+++ b/Web/Controllers/AccountController.cs
@@ -67,17 +67,18 @@ public IActionResult LogOut()
public async Task OnPostConfirmation(string returnUrl, string provider)
{
-
try
{
if (string.IsNullOrWhiteSpace(provider))
{
return SignOut(new AuthenticationProperties { RedirectUri = "/" }, CookieAuthenticationDefaults.AuthenticationScheme).WithError("Ocurrió un error autenticando tu cuenta");
}
+
var loginInfo = _loginService.GetLogin(provider.ToLower(), _currentUser.SocialId);
- if(loginInfo == null) //Create new account
+ if (loginInfo == null) // Create new account
{
- var newUser = new User {
+ var newUser = new User
+ {
Email = _currentUser.Email,
Name = _currentUser.Name,
};
@@ -99,10 +100,10 @@ public async Task OnPostConfirmation(string returnUrl, string pro
}
else
{
- HttpContext.Session.SetInt32("UserId",loginInfo.UserId);
+ HttpContext.Session.SetInt32("UserId", loginInfo.UserId);
}
}
- catch(Exception ex)
+ catch (Exception ex)
{
HttpContext.RiseError(ex);
if (ex.InnerException != null)
@@ -110,6 +111,7 @@ public async Task OnPostConfirmation(string returnUrl, string pro
return SignOut(new AuthenticationProperties { RedirectUri = "/" }, CookieAuthenticationDefaults.AuthenticationScheme).WithError(ex.Message);
}
+
returnUrl = returnUrl ?? Url.Content("~/");
return Redirect(returnUrl);
diff --git a/Web/Controllers/BaseController.cs b/Web/Controllers/BaseController.cs
index ae32a9d..7b2f0c1 100644
--- a/Web/Controllers/BaseController.cs
+++ b/Web/Controllers/BaseController.cs
@@ -12,7 +12,6 @@ public class BaseController : Controller
{
protected ApplicationUser _currentUser => new ApplicationUser(HttpContext.User);
-
public override void OnActionExecuting(ActionExecutingContext context)
{
// TODO Review this
@@ -24,8 +23,10 @@ public override void OnActionExecuting(ActionExecutingContext context)
ModelState.AddModelError("", error);
}
}
+
base.OnActionExecuting(context);
}
+
protected IActionResult RedirectToLocal(string action, object model, object routeValues = null)
{
TempData.Put("Model", model);
@@ -34,6 +35,7 @@ protected IActionResult RedirectToLocal(string action, object model, object rout
var modelErrors = string.Join(",", ModelState[""].Errors.Select(x => x.ErrorMessage).ToArray());
TempData.Put("ModelErrors", modelErrors);
}
+
return RedirectToAction(action, routeValues);
}
}
diff --git a/Web/Controllers/CompaniesController.cs b/Web/Controllers/CompaniesController.cs
index 5cd2a10..017806f 100644
--- a/Web/Controllers/CompaniesController.cs
+++ b/Web/Controllers/CompaniesController.cs
@@ -29,8 +29,8 @@ public IActionResult Index()
var companies = _companiesService.GetAll();
return View(companies);
}
-
- [Authorize]
+
+ [Authorize]
public IActionResult Wizard(int? id)
{
var model = new CompanyViewModel();
@@ -39,7 +39,7 @@ public IActionResult Wizard(int? id)
{
var company = _companiesService.GetById(id.Value);
- if(company.UserId == _currentUser.UserId)
+ if (company.UserId == _currentUser.UserId)
{
model.Id = company.Id;
model.Name = company.Name;
@@ -49,7 +49,7 @@ public IActionResult Wizard(int? id)
model.Email = company.Email;
}
else
- {
+ {
return RedirectToAction("Index", "UserProfile").WithError("No tienes permiso para editar esta Compañia");
}
}
@@ -57,7 +57,7 @@ public IActionResult Wizard(int? id)
return View(model);
}
- [Authorize]
+ [Authorize]
[HttpPost]
public IActionResult Wizard(CompanyViewModel model)
{
@@ -66,11 +66,11 @@ public IActionResult Wizard(CompanyViewModel model)
try
{
- if(model.Id > 0)
+ if (model.Id > 0)
{
var companyToUpdate = _companiesService.GetById(model.Id);
- if(companyToUpdate.UserId == _currentUser.UserId)
+ if (companyToUpdate.UserId == _currentUser.UserId)
{
companyToUpdate.Name = model.Name;
companyToUpdate.Url = model.Url;
@@ -79,7 +79,7 @@ public IActionResult Wizard(CompanyViewModel model)
var result = _companiesService.Update(companyToUpdate);
- if(result.Success)
+ if (result.Success)
{
return RedirectToAction("Index", "UserProfile").WithSuccess("Compañia editada exitosamente");
}
@@ -87,10 +87,11 @@ public IActionResult Wizard(CompanyViewModel model)
return View(model).WithError(result.Messages);
}
else
- {
+ {
return RedirectToAction("Index", "UserProfile").WithError("No tienes permiso para editar esta Compañia");
}
- } else
+ }
+ else
{
var company = new Company
{
@@ -112,23 +113,21 @@ public IActionResult Wizard(CompanyViewModel model)
var result = _companiesService.Create(company);
- if(result.Success)
+ if (result.Success)
{
return RedirectToAction("Index", "UserProfile").WithSuccess("Compañia creada exitosamente");
}
return View(model).WithError(result.Messages);
- }
+ }
}
- catch(Exception ex)
+ catch (Exception ex)
{
HttpContext.RiseError(ex);
return View(model).WithError(ex.Message);
}
-
}
-
[Authorize]
[HttpPost]
public JsonResult Delete(int id)
@@ -139,23 +138,23 @@ public JsonResult Delete(int id)
{
var company = _companiesService.GetById(id);
- if(company == null)
+ if (company == null)
{
result.AddErrorMessage("No puedes eliminar una Compañia que no existe.");
}
- else if(company.UserId != _currentUser.UserId)
+ else if (company.UserId != _currentUser.UserId)
{
result.AddErrorMessage("No puedes eliminar una Compañia que no creaste.");
}
-
+
result = _companiesService.Delete(company);
}
- catch(Exception ex)
+ catch (Exception ex)
{
HttpContext.RiseError(ex);
result.AddErrorMessage(ex.Message);
}
-
+
return Json(result);
}
}
diff --git a/Web/Controllers/CreditsController.cs b/Web/Controllers/CreditsController.cs
index 76f0a7c..c57383c 100644
--- a/Web/Controllers/CreditsController.cs
+++ b/Web/Controllers/CreditsController.cs
@@ -5,7 +5,6 @@ namespace Web.Controllers
{
public class CreditsController : BaseController
{
-
public IActionResult Index()
{
return View();
diff --git a/Web/Controllers/JobsController.cs b/Web/Controllers/JobsController.cs
index 0f7e23c..3243b4e 100644
--- a/Web/Controllers/JobsController.cs
+++ b/Web/Controllers/JobsController.cs
@@ -121,7 +121,6 @@ public async Task Wizard(WizardViewModel model)
var companyId = model.CompanyId;
if (model.CreateNewCompany)
{
-
var company = new Company
{
Name = model.CompanyName,
@@ -139,6 +138,7 @@ public async Task Wizard(WizardViewModel model)
{
company.LogoUrl = $"{this.Request.Scheme}://{this.Request.Host}{Constants.DefaultLogoUrl}";
}
+
_companiesService.Create(company);
companyId = company.Id;
}
@@ -148,7 +148,6 @@ public async Task Wizard(WizardViewModel model)
var originalJob = _jobsService.GetById(model.Id.Value);
if (originalJob.UserId == _currentUser.UserId)
{
-
originalJob.CategoryId = model.CategoryId;
originalJob.HireTypeId = model.JobTypeId;
originalJob.CompanyId = companyId.Value;
@@ -167,6 +166,7 @@ public async Task Wizard(WizardViewModel model)
Latitude = model.LocationLatitude
};
}
+
var result = _jobsService.Update(originalJob);
if (result.Success)
{
@@ -178,6 +178,7 @@ public async Task Wizard(WizardViewModel model)
{
HttpContext.RiseError(ex);
}
+
return RedirectToAction("Wizard", new { Id = model.Id.Value }).WithSuccess("Posición editada exitosamente");
}
@@ -228,7 +229,6 @@ public async Task Wizard(WizardViewModel model)
throw new Exception(result.Messages);
}
-
}
catch (Exception ex)
{
@@ -236,15 +236,16 @@ public async Task Wizard(WizardViewModel model)
return View(model).WithError(ex.Message);
}
}
+
return View(model);
}
public async Task Details(string Id, bool isPreview = false, bool isLegacy = false)
{
- if (String.IsNullOrEmpty(Id))
+ if (string.IsNullOrEmpty(Id))
return RedirectToAction(nameof(this.Index));
- int jobId = Int32.Parse(Id);
+ int jobId = int.Parse(Id);
Job job = new Job();
if (isLegacy)
{
@@ -296,15 +297,15 @@ public async Task Details(string Id, bool isPreview = false, bool
if (!isLegacy)
{
- //Get the list of jobs visited in the cookie
- //Format: comma separated jobs Id
- //Naming: appname_meanfulname
+ // Get the list of jobs visited in the cookie
+ // Format: comma separated jobs Id
+ // Naming: appname_meanfulname
var visitedJobs = Request.Cookies["empleado_visitedjobs"];
- //If cookie value is null (not set) use empty string to avoid NullReferenceException
+ // If cookie value is null (not set) use empty string to avoid NullReferenceException
var visitedJobsList = (visitedJobs ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries);
- //If jobs has not be visited update ViewCount & add job Id to cookie
+ // If jobs has not be visited update ViewCount & add job Id to cookie
if (!visitedJobsList.Contains(Id))
{
job.ViewCount++;
@@ -321,13 +322,14 @@ public async Task Details(string Id, bool isPreview = false, bool
viewModel.IsPreview = isPreview;
return View(viewModel);
}
+
return View(viewModel);
}
private int GetJobIdFromTitle(string title)
{
var url = title.Split('-');
- if (String.IsNullOrEmpty(title) || title.Length == 0 || !int.TryParse(url[0], out int id))
+ if (string.IsNullOrEmpty(title) || title.Length == 0 || !int.TryParse(url[0], out int id))
return 0;
return id;
}
@@ -359,6 +361,7 @@ public JsonResult Hide(int id)
HttpContext.RiseError(ex);
result.AddErrorMessage(ex.Message);
}
+
return Json(result);
}
@@ -396,10 +399,10 @@ public JsonResult Delete(int id)
HttpContext.RiseError(ex);
result.AddErrorMessage(ex.Message);
}
+
return Json(result);
}
-
///
/// Validates the payload response that comes from the Slack interactive message actions
///
@@ -467,6 +470,5 @@ public async Task Validate([FromForm] string payload)
HttpContext.RiseError(ex.InnerException);
}
}
-
}
}
diff --git a/Web/Controllers/SponsorsController.cs b/Web/Controllers/SponsorsController.cs
index 503f2c5..c13af45 100644
--- a/Web/Controllers/SponsorsController.cs
+++ b/Web/Controllers/SponsorsController.cs
@@ -20,14 +20,13 @@ public string GetOpenCollective(string members)
{
// It's not call directly from AJAX due to CORS.
var resultString = WebRequestHelper("https://opencollective.com/emplea_do/members/" + members);
- //var resultObject = JsonConvert.DeserializeObject(resultString);
+ // var resultObject = JsonConvert.DeserializeObject(resultString);
return resultString;
}
public string WebRequestHelper(string endpoint)
{
-
WebRequest request = WebRequest.Create(endpoint);
WebResponse response = request.GetResponse();
@@ -39,6 +38,7 @@ public string WebRequestHelper(string endpoint)
StreamReader reader = new StreamReader(dataStream);
responseFromServer = reader.ReadToEnd();
}
+
response.Close();
return responseFromServer;
diff --git a/Web/Controllers/UserProfileController.cs b/Web/Controllers/UserProfileController.cs
index 162a172..919c5b7 100644
--- a/Web/Controllers/UserProfileController.cs
+++ b/Web/Controllers/UserProfileController.cs
@@ -22,7 +22,7 @@ public UserProfileController(IJobsService jobsService, IUsersService usersServic
public IActionResult Index()
{
var filteredJobsByUserProfile = _jobsService.GetByUser(_currentUser.UserId);
- //var filteredCompaniesByUserProfile = _companiesService.GetByUserId(_currentUser.UserId);
+ // var filteredCompaniesByUserProfile = _companiesService.GetByUserId(_currentUser.UserId);
var filteredCompaniesByUserProfile = _companiesService.GetByUserId(_currentUser.UserId);
var viewModel = new UserProfileViewModel
{
diff --git a/Web/Framework/ApplicationUser.cs b/Web/Framework/ApplicationUser.cs
index e7b3d48..e767594 100644
--- a/Web/Framework/ApplicationUser.cs
+++ b/Web/Framework/ApplicationUser.cs
@@ -16,7 +16,7 @@ public ApplicationUser(ClaimsPrincipal user)
_user = user;
}
- public bool IsAuthenticated { get { return _user.Identity.IsAuthenticated; } }
+ public bool IsAuthenticated { get { return _user.Identity.IsAuthenticated; } }
public int UserId { get { return Convert.ToInt32(_user.FindFirst("UserId").Value); } }
public string SocialId { get { return _user.FindFirst(ClaimTypes.NameIdentifier).Value; } }
public string Email { get { return _user.FindFirst(ClaimTypes.Email).Value; } }
diff --git a/Web/Framework/Configurations/AuthConfiguration.cs b/Web/Framework/Configurations/AuthConfiguration.cs
index a7fb990..bf61d87 100644
--- a/Web/Framework/Configurations/AuthConfiguration.cs
+++ b/Web/Framework/Configurations/AuthConfiguration.cs
@@ -16,7 +16,6 @@ public class AuthConfiguration
{
public static void Init(IConfiguration configuration, IServiceCollection services)
{
-
var featureManager = services.BuildServiceProvider().GetService();
services.AddAuthentication(options =>
{
@@ -29,7 +28,7 @@ public static void Init(IConfiguration configuration, IServiceCollection service
options.LogoutPath = "/account/logout";
options.SlidingExpiration = true;
});
- if(featureManager.IsEnabledAsync(FeatureFlags.UseGoogleAuthentication).Result)
+ if (featureManager.IsEnabledAsync(FeatureFlags.UseGoogleAuthentication).Result)
services.AddAuthentication().AddGoogle(googleOptions =>
{
googleOptions.ClientId = configuration["Authentication:Google:ClientId"];
@@ -43,51 +42,55 @@ public static void Init(IConfiguration configuration, IServiceCollection service
googleOptions.ClaimActions.MapJsonKey("urn:google:profile", "link");
googleOptions.ClaimActions.MapJsonKey(ClaimTypes.Email, "email");
googleOptions.SaveTokens = true;
- googleOptions.Events.OnCreatingTicket = ctx => {
+ googleOptions.Events.OnCreatingTicket = ctx =>
+ {
return ProcessUser(ctx, "Google", services);
};
});
-
- if(featureManager.IsEnabledAsync(FeatureFlags.UseFacebookAuthentication).Result)
+
+ if (featureManager.IsEnabledAsync(FeatureFlags.UseFacebookAuthentication).Result)
services.AddAuthentication().AddFacebook(facebookOptions =>
{
facebookOptions.AppId = configuration["Authentication:Facebook:AppId"];
facebookOptions.AppSecret = configuration["Authentication:Facebook:AppSecret"];
- facebookOptions.Events.OnCreatingTicket = ctx => {
+ facebookOptions.Events.OnCreatingTicket = ctx =>
+ {
return ProcessUser(ctx, "Facebook", services);
};
});
- if(featureManager.IsEnabledAsync(FeatureFlags.UseMicrosoftAuthentication).Result)
+ if (featureManager.IsEnabledAsync(FeatureFlags.UseMicrosoftAuthentication).Result)
services.AddAuthentication().AddMicrosoftAccount(microsoftOptions =>
{
microsoftOptions.ClientId = configuration["Authentication:Microsoft:ClientId"];
microsoftOptions.ClientSecret = configuration["Authentication:Microsoft:ClientSecret"];
- microsoftOptions.Events.OnCreatingTicket = ctx => {
+ microsoftOptions.Events.OnCreatingTicket = ctx =>
+ {
return ProcessUser(ctx, "Microsoft", services);
};
});
- if(featureManager.IsEnabledAsync(FeatureFlags.UseLinkedInAuthentication).Result)
+ if (featureManager.IsEnabledAsync(FeatureFlags.UseLinkedInAuthentication).Result)
services.AddAuthentication().AddLinkedIn(linkedinOptions =>
{
linkedinOptions.ClientId = configuration["Authentication:LinkedIn:ClientId"];
linkedinOptions.ClientSecret = configuration["Authentication:LinkedIn:ClientSecret"];
- linkedinOptions.Events.OnCreatingTicket = ctx => {
+ linkedinOptions.Events.OnCreatingTicket = ctx =>
+ {
return ProcessUser(ctx, "linkedin", services);
};
});
- if(featureManager.IsEnabledAsync(FeatureFlags.UseGithubAuthentication).Result)
+ if (featureManager.IsEnabledAsync(FeatureFlags.UseGithubAuthentication).Result)
services.AddAuthentication().AddGitHub(githubOptions =>
{
- githubOptions.ClientId = configuration["Authentication:Github:ClientId"];
- githubOptions.ClientSecret = configuration["Authentication:Github:ClientSecret"];
- githubOptions.Scope.Add("user:email");
- githubOptions.Events.OnCreatingTicket = ctx => {
- return ProcessUser(ctx, "github", services);
- };
- });
+ githubOptions.ClientId = configuration["Authentication:Github:ClientId"];
+ githubOptions.ClientSecret = configuration["Authentication:Github:ClientSecret"];
+ githubOptions.Scope.Add("user:email");
+ githubOptions.Events.OnCreatingTicket = ctx =>
+ {
+ return ProcessUser(ctx, "github", services);
+ };
+ });
}
-
public static Task ProcessUser(OAuthCreatingTicketContext ctx, string provider, IServiceCollection services)
{
var serviceProvider = services.BuildServiceProvider();
@@ -97,7 +100,7 @@ public static Task ProcessUser(OAuthCreatingTicketContext ctx, string provider,
var currentUser = ctx.Identity;
var socialId = currentUser.FindFirst(ClaimTypes.NameIdentifier).Value;
var loginInfo = loginService.GetLogin(provider.ToLower(), socialId);
- if (loginInfo == null) //Create new account
+ if (loginInfo == null) // Create new account
{
var newUser = new User
{
@@ -124,6 +127,7 @@ public static Task ProcessUser(OAuthCreatingTicketContext ctx, string provider,
var userIdClaim = new Claim("UserId", loginInfo.UserId.ToString());
ctx.Identity.AddClaim(userIdClaim);
}
+
return Task.CompletedTask;
}
}
diff --git a/Web/Framework/Configurations/IocConfiguration.cs b/Web/Framework/Configurations/IocConfiguration.cs
index 999a4c0..49b5ebf 100644
--- a/Web/Framework/Configurations/IocConfiguration.cs
+++ b/Web/Framework/Configurations/IocConfiguration.cs
@@ -20,19 +20,16 @@ public static void Init(IConfiguration configuration, IServiceCollection service
.AsMatchingInterface()
.WithScopedLifetime());
-
services.Scan(x => x.FromAssemblyOf()
.AddClasses()
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
.AsMatchingInterface()
.WithScopedLifetime());
- services.AddSingleton();
- //services.AddSingleton();
+ services.AddSingleton();
+ // services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
-
}
-
}
}
diff --git a/Web/Framework/Extensions/BoolExtensions.cs b/Web/Framework/Extensions/BoolExtensions.cs
index b5064d3..617b7d8 100644
--- a/Web/Framework/Extensions/BoolExtensions.cs
+++ b/Web/Framework/Extensions/BoolExtensions.cs
@@ -5,11 +5,12 @@ public static class BoolExtensions
{
public static string ToYesNoString(this bool val)
{
- return (val) ? "Si" : "No";
+ return val ? "Si" : "No";
}
+
public static string ToCheckTimesString(this bool val)
{
- return (val) ? "" : "";
+ return val ? "" : "";
}
}
}
diff --git a/Web/Framework/Extensions/CookiesExtensions.cs b/Web/Framework/Extensions/CookiesExtensions.cs
index dc644fa..c35bb3b 100644
--- a/Web/Framework/Extensions/CookiesExtensions.cs
+++ b/Web/Framework/Extensions/CookiesExtensions.cs
@@ -5,7 +5,7 @@
namespace Web.Framework.Helpers
{
public static class CookiesExtensions
- {
+ {
public static void SetCookie(this HttpContext context, string key, string value)
{
context.Response.Cookies.Append(key, value);
@@ -14,7 +14,7 @@ public static void SetCookie(this HttpContext context, string key, string value)
public static string GetCookie(this HttpContext context, string key)
{
var cookie = context.Request.Cookies[key];
- return !string.IsNullOrWhiteSpace(cookie) ? WebUtility.HtmlEncode(cookie).Trim() : String.Empty;
+ return !string.IsNullOrWhiteSpace(cookie) ? WebUtility.HtmlEncode(cookie).Trim() : string.Empty;
}
public static bool CookieExists(this HttpContext context, string key)
diff --git a/Web/Framework/Extensions/DateTimeExtensions.cs b/Web/Framework/Extensions/DateTimeExtensions.cs
index 3e804b6..6deb411 100644
--- a/Web/Framework/Extensions/DateTimeExtensions.cs
+++ b/Web/Framework/Extensions/DateTimeExtensions.cs
@@ -1,7 +1,7 @@
using System;
using System.Globalization;
namespace Web.Framework.Extensions
-{
+{
public static class DateTimeExtensions
{
///
diff --git a/Web/Framework/Extensions/HtmlHelperExtensions.cs b/Web/Framework/Extensions/HtmlHelperExtensions.cs
index 2d14d92..1efcd4b 100644
--- a/Web/Framework/Extensions/HtmlHelperExtensions.cs
+++ b/Web/Framework/Extensions/HtmlHelperExtensions.cs
@@ -8,8 +8,8 @@
using Microsoft.AspNetCore.Routing;
namespace Web.Framework.Extensions
-{
- public static class HtmlHelperExtensions
+{
+ public static class HtmlHelperExtensions
{
///
/// Obtiene la versión del assembly actual como un string
@@ -21,6 +21,7 @@ public static HtmlString AssemblyVersion(this IHtmlHelper helper)
var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return new HtmlString(version);
}
+
///
/// Agrega la clase active al elemento dependiendo de la ruta en la que este
///
@@ -37,12 +38,12 @@ public static string IsSelected(this IHtmlHelper html, string controllers = "",
string currentAction = routeValues["action"].ToString();
string currentController = routeValues["controller"].ToString();
- if (String.IsNullOrEmpty(actions))
+ if (string.IsNullOrEmpty(actions))
{
actions = currentAction;
}
- if (String.IsNullOrEmpty(controllers))
+ if (string.IsNullOrEmpty(controllers))
{
controllers = currentController;
}
@@ -54,8 +55,10 @@ public static string IsSelected(this IHtmlHelper html, string controllers = "",
{
return cssClass;
}
+
return string.Empty;
}
+
///
/// Obtener de las dos primemras palabras su primera letra. Sí el texto solo posee una palabra solo se retorna la primera letra de la misma
///
@@ -66,7 +69,7 @@ public static HtmlString FirstTwoLetters(this IHtmlHelper helper, string value)
{
var result = string.Empty;
- if (!String.IsNullOrEmpty(value))
+ if (!string.IsNullOrEmpty(value))
{
var splited = Regex.Split(value, @"[_+-.,!@#$%^&*();\/|<> ]|[0-9]");
diff --git a/Web/Framework/Extensions/HttpContextExtensions.cs b/Web/Framework/Extensions/HttpContextExtensions.cs
index 15a58da..cefa54d 100644
--- a/Web/Framework/Extensions/HttpContextExtensions.cs
+++ b/Web/Framework/Extensions/HttpContextExtensions.cs
@@ -36,6 +36,7 @@ public static async Task IsProviderSupportedAsync(this HttpContext context
where string.Equals(scheme.Name, provider, StringComparison.OrdinalIgnoreCase)
select scheme).Any();
}
+
/*
public static string GetRawBodyString(this HttpContext httpContext, Encoding encoding)
{
diff --git a/Web/Framework/Extensions/NumberExtensions.cs b/Web/Framework/Extensions/NumberExtensions.cs
index b8d864b..17308c8 100644
--- a/Web/Framework/Extensions/NumberExtensions.cs
+++ b/Web/Framework/Extensions/NumberExtensions.cs
@@ -1,6 +1,6 @@
using System;
namespace Web.Framework.Extensions
-{
+{
public static class NumberExtensions
{
public static string FormatThousand(this int number)
diff --git a/Web/Framework/Extensions/StringExtensions.cs b/Web/Framework/Extensions/StringExtensions.cs
index 7f623f1..67addc5 100644
--- a/Web/Framework/Extensions/StringExtensions.cs
+++ b/Web/Framework/Extensions/StringExtensions.cs
@@ -4,7 +4,7 @@
namespace Web.Framework.Extensions
{
public static class StringExtensions
- {
+ {
///
/// Sanitiza un URL
///
diff --git a/Web/Framework/Extensions/UrlExtensions.cs b/Web/Framework/Extensions/UrlExtensions.cs
index 1a1e47f..7fb3ace 100644
--- a/Web/Framework/Extensions/UrlExtensions.cs
+++ b/Web/Framework/Extensions/UrlExtensions.cs
@@ -29,7 +29,6 @@ public static string SeoUrl(string actionName, int id)
return $"{SanitizeUrl(actionName)}/{id}";
}
-
public static bool IsValidImageUrl(string imageUrl)
{
var regex = new Regex("^(http|https)://(.+).(png|jpg)$");
@@ -52,6 +51,7 @@ public static bool IsImageAvailable(string imageUrl)
return false;
}
}
+
///
/// Generates a fully qualified URL to an action method by using
/// the specified action name, controller name and route values.
diff --git a/Web/Framework/Filters/UnderMaintenanceFilterAttribute.cs b/Web/Framework/Filters/UnderMaintenanceFilterAttribute.cs
index 6f27006..b895f41 100644
--- a/Web/Framework/Filters/UnderMaintenanceFilterAttribute.cs
+++ b/Web/Framework/Filters/UnderMaintenanceFilterAttribute.cs
@@ -35,8 +35,8 @@ public override void OnActionExecuting(ActionExecutingContext context)
context.Result = new RedirectToRouteResult(
new RouteValueDictionary
{
- { "controller", "UnderMaintenance"},
- { "action", "Index"}
+ { "controller", "UnderMaintenance" },
+ { "action", "Index" }
});
}
diff --git a/Web/Framework/ViewPageBase.cs b/Web/Framework/ViewPageBase.cs
index 0ab11cf..9726b4a 100644
--- a/Web/Framework/ViewPageBase.cs
+++ b/Web/Framework/ViewPageBase.cs
@@ -6,9 +6,8 @@ namespace Web.Framework
{
public abstract class ViewPageBase : RazorPage
{
- public String Title { get; set; }
+ public string Title { get; set; }
protected ApplicationUser CurrentUser => new ApplicationUser(Context.User);
-
}
}
diff --git a/Web/Legacy/LegacyAPI.cs b/Web/Legacy/LegacyAPI.cs
index 8a7af19..229cfe6 100644
--- a/Web/Legacy/LegacyAPI.cs
+++ b/Web/Legacy/LegacyAPI.cs
@@ -5,16 +5,16 @@
using Newtonsoft.Json.Converters;
namespace LegacyAPI
-{
+{
public class JobCardDTO
- {
- public string Link{ get; set; }
+ {
+ public string Link { get; set; }
public string CompanyName { get; set; }
public string Title { get; set; }
- public string JobType{ get; set; }
- public string Location{ get; set; }
+ public string JobType { get; set; }
+ public string Location { get; set; }
public DateTime PublishedDate { get; set; }
- public bool IsRemote{ get; set; }
+ public bool IsRemote { get; set; }
public int ViewCount { get; set; }
public int Likes { get; set; }
public string CompanyLogoUrl { get; set; }
diff --git a/Web/Legacy/LegacyApiClient.cs b/Web/Legacy/LegacyApiClient.cs
index f782844..e452985 100644
--- a/Web/Legacy/LegacyApiClient.cs
+++ b/Web/Legacy/LegacyApiClient.cs
@@ -17,9 +17,10 @@ public class LegacyJobCardsResult
public int CurrentPage;
public int PageSize;
}
+
public class LegacyApiClient
{
- private readonly IFeatureManager _featureManager;
+ private readonly IFeatureManager _featureManager;
private readonly IConfiguration _configuration;
public LegacyApiClient(IFeatureManager featureManager, IConfiguration configuration)
@@ -27,19 +28,18 @@ public LegacyApiClient(IFeatureManager featureManager, IConfiguration configurat
_featureManager = featureManager;
_configuration = configuration;
}
-
+
public async Task> GetJobsFromLegacy()
{
- //if(_featureManager.IsEnabled(FeatureFlags.LegacyClient.UseMockData))
- return GetJobsFromMockData();
- //return await GetJobsFromLegacyCore();
-
+ // if(_featureManager.IsEnabled(FeatureFlags.LegacyClient.UseMockData))
+ return GetJobsFromMockData();
+ // return await GetJobsFromLegacyCore();
}
public async Task GetJobById(string Id)
{
- if(await _featureManager.IsEnabledAsync(FeatureFlags.LegacyClient.UseMockData))
- return GetJobByIdFromMockData(Id);
+ if (await _featureManager.IsEnabledAsync(FeatureFlags.LegacyClient.UseMockData))
+ return GetJobByIdFromMockData(Id);
return await GetJobByIdCore(Id);
}
@@ -47,10 +47,10 @@ public async Task GetJobById(string Id)
private async Task> GetJobsFromLegacyCore()
{
int pageSize = _configuration.GetValue(ConfigurationFlags.LegacyApiClient.PageSize, 10);
-
+
var r = await GetBaseAPIUrl()
.AppendPathSegment("jobs")
- .SetQueryParams(new { pagesize = pageSize, page = 1 }) // This should be parameterized in the future.
+ .SetQueryParams(new { pagesize = pageSize, page = 1 }) // This should be parameterized in the future.
.GetJsonAsync();
return r.Jobs;
@@ -63,13 +63,11 @@ private string GetBaseAPIUrl()
private async Task GetJobByIdCore(string Id)
{
-
var jobs = await GetJobsFromLegacy();
var j = jobs.FirstOrDefault(i => i.Link == Id);
return j;
-
- }
+ }
private IList GetJobsFromMockData()
{
@@ -80,14 +78,11 @@ private IList GetJobsFromMockData()
private JobCardDTO GetJobByIdFromMockData(string Id)
{
var list = GetJobsFromMockData();
- return list.FirstOrDefault(j=> j.Link == Id);
+ return list.FirstOrDefault(j => j.Link == Id);
}
-
}
-
public static class FakeData
-
{
public static string GetFakeData()
{
@@ -156,6 +151,5 @@ public static string GetFakeData()
},
]
}";
+ }
}
-}
-
diff --git a/Web/Program.cs b/Web/Program.cs
index 8aa96ba..470f545 100644
--- a/Web/Program.cs
+++ b/Web/Program.cs
@@ -38,12 +38,11 @@ public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
private static void ConfigureAzureAppConfiguration(ref IConfigurationBuilder config)
{
- // For the production environment, we are going to use
- //Azure App Configuration as our provider of (1) App Configuration and (2) Feature Flags
+ // For the production environment, we are going to use
+ // Azure App Configuration as our provider of (1) App Configuration and (2) Feature Flags
if (HostingEnvironment.IsProduction())
{
-
var settings = config.Build();
var connectionString = settings["AzureAppConfigurationConnectionString"];
diff --git a/Web/Services/Slack/SlackService.cs b/Web/Services/Slack/SlackService.cs
index be40fdd..12592e0 100644
--- a/Web/Services/Slack/SlackService.cs
+++ b/Web/Services/Slack/SlackService.cs
@@ -23,7 +23,7 @@ public class SlackService : ISlackService
public SlackService(IConfiguration configuration)
{
var slackWebhookEndpoint = configuration["Slack:WebhookEndpoint"];
- _slackWebhookUrl = slackWebhookEndpoint; //"https://hooks.slack.com/services/" + slackWebhookEndpoint;
+ _slackWebhookUrl = slackWebhookEndpoint; // "https://hooks.slack.com/services/" + slackWebhookEndpoint;
}
public async Task PostJobErrorResponse(Job jobOpportunity, IUrlHelper urlHelper, string responseUrl)
@@ -40,7 +40,7 @@ public async Task PostJobErrorResponse(Job jobOpportunity, IUrlHelper urlHelper,
callback_id = "0",
color = "danger",
attachment_type = "default"
- }}
+ } }
};
await PostNotification(payloadObject, responseUrl).ConfigureAwait(false);
}
@@ -56,7 +56,7 @@ public async Task PostJobErrorResponse(Job jobOpportunity, IUrlHelper urlHelper,
callback_id = jobOpportunity?.Id.ToString(),
color = "danger",
attachment_type = "default"
- }}
+ } }
};
await PostNotification(payloadObject, responseUrl).ConfigureAwait(false);
}
@@ -68,11 +68,11 @@ public async Task PostJobResponse(Job jobOpportunity, IUrlHelper urlHelper, stri
return;
var descriptionLength = 124;
- var trimmedDescription = Regex.Replace(jobOpportunity.Description, "<.*?>", String.Empty).TrimStart();
+ var trimmedDescription = Regex.Replace(jobOpportunity.Description, "<.*?>", string.Empty).TrimStart();
var limitedDescription = trimmedDescription.Length > descriptionLength
? trimmedDescription.Substring(0, descriptionLength) + "..."
: trimmedDescription;
- //var action = UrlExtensions.SeoUrl(jobOpportunity.Id, jobOpportunity.Title);
+ // var action = UrlExtensions.SeoUrl(jobOpportunity.Id, jobOpportunity.Title);
var action = UrlExtensions.SeoUrl("details", jobOpportunity.Id);
var approvedMessage = approved ? "approved" : "rejected";
@@ -95,8 +95,8 @@ public async Task PostJobResponse(Job jobOpportunity, IUrlHelper urlHelper, stri
title = "",
value = ":ballot_box_with_check: <@" + userId + "> *" + approvedMessage + " this request*",
@short = false
- }}
- }}
+ } }
+ } }
};
await PostNotification(payloadObject, responseUrl).ConfigureAwait(false);
@@ -108,11 +108,11 @@ public async Task PostJob(Job jobOpportunity, IUrlHelper urlHelper)
return;
var descriptionLength = 124;
- var trimmedDescription = Regex.Replace(jobOpportunity.Description, "<.*?>", String.Empty).TrimStart();
+ var trimmedDescription = Regex.Replace(jobOpportunity.Description, "<.*?>", string.Empty).TrimStart();
var limitedDescription = trimmedDescription.Length > descriptionLength
? trimmedDescription.Substring(0, descriptionLength) + "..."
: trimmedDescription;
- // var action = UrlExtensions.SeoUrl(jobOpportunity.Id, jobOpportunity.Title);
+ // var action = UrlExtensions.SeoUrl(jobOpportunity.Id, jobOpportunity.Title);
var action = UrlExtensions.SeoUrl("details", jobOpportunity.Id);
var payloadObject = new PayloadRequestDto()
@@ -141,8 +141,8 @@ public async Task PostJob(Job jobOpportunity, IUrlHelper urlHelper)
style = "default",
type = "button",
value = "reject"
- }}
- }}
+ } }
+ } }
};
await PostNotification(payloadObject, _slackWebhookUrl).ConfigureAwait(false);
diff --git a/Web/Startup.cs b/Web/Startup.cs
index a029d79..ef1828e 100644
--- a/Web/Startup.cs
+++ b/Web/Startup.cs
@@ -37,50 +37,51 @@ public void ConfigureServices(IServiceCollection services)
services.Configure(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
- //options.CheckConsentNeeded = context => true;
+ // options.CheckConsentNeeded = context => true;
// options.MinimumSameSitePolicy = SameSiteMode.None;
});
// Registers the standard IFeatureManager implementation, which utilizes the .NET Standard configuration system.
- //Read more https://andrewlock.net/introducing-the-microsoft-featuremanagement-library-adding-feature-flags-to-an-asp-net-core-app-part-1/
+ // Read more https://andrewlock.net/introducing-the-microsoft-featuremanagement-library-adding-feature-flags-to-an-asp-net-core-app-part-1/
#if DEBUG
- services.AddDbContext(options => options.UseSqlite(Configuration.GetConnectionString("DefaultConnection")));
- #else
+ services.AddDbContext(options => options.UseSqlite(Configuration.GetConnectionString("DefaultConnection")));
+#else
services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
- #endif
-
+#endif
+
services.Configure(Configuration.GetSection("TwitterConfig"));
services.Configure(Configuration);
-
-
+
IocConfiguration.Init(Configuration, services);
AuthConfiguration.Init(Configuration, services);
- services.AddElmah(options => {
+ services.AddElmah(options =>
+ {
options.LogPath = "~/Helpers/log";
options.Path = "ErrorLogs";
options.CheckPermissionAction = context => context.User.Identity.IsAuthenticated;
});
- services.Configure(options => {
+ services.Configure(options =>
+ {
options.AllowSynchronousIO = true;
});
services.AddSession();
- //services.AddMvc();//option => option.EnableEndpointRouting = false).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
+ // services.AddMvc();//option => option.EnableEndpointRouting = false).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
Console.WriteLine("Startup.ConfigureServices() End");
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
- Console.WriteLine("Startup.Configure() Begin");
-
- #if DEBUG
- app.UseDeveloperExceptionPage();
- #else
+ Console.WriteLine("Startup.Configure() Begin");
+
+#if DEBUG
+ app.UseDeveloperExceptionPage();
+#else
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
- #endif
+#endif
app.UseAzureAppConfiguration();
app.UseHttpsRedirection();
app.UseStaticFiles();
diff --git a/Web/ViewModels/JobDetailsViewModel.cs b/Web/ViewModels/JobDetailsViewModel.cs
index ace7c45..87167d0 100644
--- a/Web/ViewModels/JobDetailsViewModel.cs
+++ b/Web/ViewModels/JobDetailsViewModel.cs
@@ -9,6 +9,6 @@ public class JobDetailsViewModel
public bool IsPreview { get; set; }
public bool IsJobOwner { get; set; }
public Job Job { get; set; }
- public JobCardDTO JobCard {get;set;}
+ public JobCardDTO JobCard { get; set; }
}
}
diff --git a/Web/ViewModels/JobSeachViewModel.cs b/Web/ViewModels/JobSeachViewModel.cs
index f7a431e..27e6949 100644
--- a/Web/ViewModels/JobSeachViewModel.cs
+++ b/Web/ViewModels/JobSeachViewModel.cs
@@ -16,8 +16,8 @@ public class JobSeachViewModel
public int? HireTypeId { get; set; }
- //public bool IsPreview { get; set; }
- //public IList JobCards { get; internal set; }
+ // public bool IsPreview { get; set; }
+ // public IList JobCards { get; internal set; }
public IEnumerable Jobs { get; set; }
public List Categories { get; set; }
diff --git a/Web/ViewModels/WizardViewModel.cs b/Web/ViewModels/WizardViewModel.cs
index 452f8bb..79fac41 100644
--- a/Web/ViewModels/WizardViewModel.cs
+++ b/Web/ViewModels/WizardViewModel.cs
@@ -6,7 +6,7 @@
namespace Web.ViewModels
{
- public class WizardViewModel: BaseViewModel
+ public class WizardViewModel : BaseViewModel
{
public int? Id { get; set; }
@@ -17,7 +17,6 @@ public class WizardViewModel: BaseViewModel
[Required(ErrorMessage = "Debes seleccionar una localidad válida")]
public string LocationPlaceId { get; set; }
-
public bool CreateNewCompany { get; set; } = true;
[Display(Name = "Compañía")]
public int? CompanyId { get; set; }
@@ -26,7 +25,6 @@ public class WizardViewModel: BaseViewModel
[Display(Name = "Título. ¿Qué estás buscando?")]
public string Title { get; set; }
-
[Required(ErrorMessage = "Debes especificar al menos un requisito."), StringLength(int.MaxValue)]
[Display(Name = "Requisitos para aplicar")]
public string Description { get; set; }
@@ -35,7 +33,7 @@ public class WizardViewModel: BaseViewModel
[Display(Name = "¿Cómo Aplicar?")]
public string HowToApply { get; set; }
- //[Required(ErrorMessage = "El nombre de la empresa es requerido."), StringLength(50)]
+ // [Required(ErrorMessage = "El nombre de la empresa es requerido."), StringLength(50)]
[Display(Name = "Nombre de la empresa")]
public string CompanyName { get; set; }
@@ -43,12 +41,11 @@ public class WizardViewModel: BaseViewModel
[Display(Name = "Sitio Web (opcional)")]
public string CompanyUrl { get; set; }
- //[Required(ErrorMessage = "El campo correo electrónico es requerido"), StringLength(int.MaxValue), EmailAddress(ErrorMessage = "Correo electrónico inválido.")]
+ // [Required(ErrorMessage = "El campo correo electrónico es requerido"), StringLength(int.MaxValue), EmailAddress(ErrorMessage = "Correo electrónico inválido.")]
[Display(Name = "Correo electrónico"),]
[DataType(DataType.EmailAddress)]
public string CompanyEmail { get; set; }
-
[StringLength(int.MaxValue), Url(ErrorMessage = "El logo de la compañía debe ser un Url válido.")]
[Display(Name = "Logo de la empresa (.jpg, .png) (opcional)")]
public string CompanyLogoUrl { get; set; }
diff --git a/Web/Web.csproj b/Web/Web.csproj
index c49fb85..9f4914d 100644
--- a/Web/Web.csproj
+++ b/Web/Web.csproj
@@ -30,6 +30,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+