Skip to content

Commit

Permalink
Merge pull request #3 from mikayel-terhov/M
Browse files Browse the repository at this point in the history
M
  • Loading branch information
ioanasolovan authored Jan 19, 2019
2 parents e5e0ef7 + 0fe2f84 commit e56db80
Show file tree
Hide file tree
Showing 59 changed files with 1,974 additions and 989 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,8 @@ ASALocalRun/

# MFractors (Xamarin productivity tool) working folder
.mfractor/
/InternshipsManagmentProject/Content/Images/82a9e6be-2931-46ae-bdd8-798d16d40e75.pdf
/InternshipsManagmentProject/Content/Images/51f14e70-2249-471e-bc1c-21e54b8bff78.pdf
/InternshipsManagmentProject/Content/Images/4ee71716-cdef-4f36-879c-a8136157efa4.pdf
/InternshipsManagmentProject/Content/Images/0e863f21-cff9-4c93-8f01-5e6ffe306980.pdf
/InternshipsManagmentProject/Content/Images
103 changes: 93 additions & 10 deletions InternshipsManagementProject.Logic/Sercice/FirmService.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,107 @@
using System;
using InternshipsManagementProject.Logic.Models;
using InternshipsManagmentProject.Data;
using InternshipsManagmentProject.Data.Repos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using InternshipsManagmentProject.Data.Interfaces;

namespace InternshipsManagementProject.Logic.Sercice
{
public class FirmService
{
private IRepository repo;
private RepositoryGenericDRH<Firm> _repo = new RepositoryGenericDRH<Firm>();

public FirmService(string connectionString)

public void InternsipService()
{
this._repo = new RepositoryGenericDRH<Firm>();
}

public LogicResponseHandler<Firm> GetById(string id)
{
var result = _repo.GetById(id);
if (result.Succes)
{
return new LogicResponseHandler<Firm> { Content = result.Container, Status = result.Succes };
}
else
{
return new LogicResponseHandler<Firm> { Status = false };
}
}

public LogicResponseHandler<IEnumerable<Firm>> GetAll()
{
var result = _repo.GetAll();
if (result.Succes)
{
return new LogicResponseHandler<IEnumerable<Firm>> { Content = result.Container, Status = result.Succes };
}
else
{
return new LogicResponseHandler<IEnumerable<Firm>> { Status = false };
}
}

public LogicResponseHandler<string> AddEntity(bool deleted, string description,
Image image, ICollection<Recruiter> recruiters, ICollection<Internship> internships,
string firmId, string logo, string name, int numberOfEmployees)
{
//this.repo = new RepositoryInternshipsManagment();
var result = _repo.AddEntity(
new Firm
{
Deleted = deleted,
Description = description,
FirmId = firmId,
Image = image,
Internships = internships,
Logo = logo,
Name = name,
NumberOfEmployees = numberOfEmployees,
Recruiters = recruiters
});

if (result.Succes)
{
return new LogicResponseHandler<string> { Status = true, Content = "Succes!" };
}
else
{
return new LogicResponseHandler<string> { Status = false, Content = result.Container };
}
}

public string GetFirmById(string guid)
public LogicResponseHandler<string> UpdateEntity(string oldGuid, string category,
string city, ICollection<Comment> comments, DateTime deadlineAplications, bool deleted,
string department, string description, string duration, DateTime endDate,
ICollection<File> files, Firm firm, string firmOrganizerid, bool hidden,
Image image, string internshipId, string internshipPostPhoto,
string keywords, DateTime lastUpdated, int positionsAvailable, Recruiter recruiter,
string recruiterResponsibleId, DateTime startDate, ICollection<StudentInternship> studentInternships,
ICollection<StudentInternship> studentInternships1, string title, string typeJob, string firmId,
ICollection<Internship> internships, string logo, string name)
{
return string.Empty;
var result = _repo.UpdateEntity(
new Firm
{
Deleted = deleted,
Description = description,
FirmId = firmId,
Image = image,
Internships = internships,
Logo = logo,
Name = name
//NumberOfEmployees= numberOfEmployees,
//Recruiters = recruiters
});

if (result.Succes)
{
return new LogicResponseHandler<string> { Status = true, Content = "Succes!" };
}
else
{
return new LogicResponseHandler<string> { Status = false, Content = result.Container };
}
}
}
}
22 changes: 9 additions & 13 deletions InternshipsManagementProject.Logic/Sercice/InternshipService.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
using InternshipsManagementProject.Logic.Models;
using InternshipsManagmentProject.Data;
using InternshipsManagmentProject.Data.Repos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InternshipsManagementProject.Logic.Sercice
{
public class InternshipService
{
private InternshipsManagmentProject.Data.Repos.InternshipRepository _repository = new InternshipsManagmentProject.Data.Repos.InternshipRepository();
private RepositoryGenericDRH<Internship> _repo = new RepositoryGenericDRH<Internship>();


public void InternsipService()
{
this._repository = new InternshipsManagmentProject.Data.Repos.InternshipRepository();


this._repo = new RepositoryGenericDRH<Internship>();
}

public LogicResponseHandler<Internship> GetById(string id)
{
var result = _repository.GetById(id);
var result = _repo.GetById(id);
if (result.Succes)
{
return new LogicResponseHandler<Internship> { Content = result.Container, Status = result.Succes };
Expand All @@ -34,7 +31,7 @@ public LogicResponseHandler<Internship> GetById(string id)

public LogicResponseHandler<IEnumerable<Internship>> GetAll()
{
var result = _repository.GetAll();
var result = _repo.GetAll();
if (result.Succes)
{
return new LogicResponseHandler<IEnumerable<Internship>> { Content = result.Container, Status = result.Succes };
Expand All @@ -54,7 +51,7 @@ public LogicResponseHandler<string> AddEntity(string category, string city,
string recruiterResponsibleId, DateTime startDate, ICollection<StudentInternship> studentInternships,
ICollection<StudentInternship> studentInternships1, string title, string typeJob)
{
var result = _repository.AddEntity(
var result = _repo.AddEntity(
new Internship
{
Category = category,
Expand Down Expand Up @@ -103,7 +100,7 @@ public LogicResponseHandler<string> UpdateEntity(string oldGuid, string category
string recruiterResponsibleId, DateTime startDate, ICollection<StudentInternship> studentInternships,
ICollection<StudentInternship> studentInternships1, string title, string typeJob)
{
var result = _repository.UpdateEntity(
var result = _repo.UpdateEntity(
new Internship
{
Category = category,
Expand Down Expand Up @@ -131,8 +128,7 @@ public LogicResponseHandler<string> UpdateEntity(string oldGuid, string category
StudentInternships = studentInternships,
Title = title,
TypeJob = typeJob
},
oldGuid);
});

if (result.Succes)
{
Expand Down
103 changes: 98 additions & 5 deletions InternshipsManagementProject.Logic/Sercice/RecruterService.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,105 @@
using System;
using InternshipsManagementProject.Logic.Models;
using InternshipsManagmentProject.Data;
using InternshipsManagmentProject.Data.Repos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InternshipsManagementProject.Logic.Sercice
{
class RecruterService
public class RecruterService
{
private RepositoryGenericDRH<Recruiter> _repo = new RepositoryGenericDRH<Recruiter>();


public void InternsipService()
{
this._repo = new RepositoryGenericDRH<Recruiter>();
}

public LogicResponseHandler<Recruiter> GetById(string id)
{
var result = _repo.GetById(id);
if (result.Succes)
{
return new LogicResponseHandler<Recruiter> { Content = result.Container, Status = result.Succes };
}
else
{
return new LogicResponseHandler<Recruiter> { Status = false };
}
}

public LogicResponseHandler<IEnumerable<Recruiter>> GetAll()
{
var result = _repo.GetAll();
if (result.Succes)
{
return new LogicResponseHandler<IEnumerable<Recruiter>> { Content = result.Container, Status = result.Succes };
}
else
{
return new LogicResponseHandler<IEnumerable<Recruiter>> { Status = false };
}
}

public LogicResponseHandler<string> AddEntity(bool deleted, Firm firm, AspNetUser aspNetUser,
string bio, string contactEmail, string firmId, ICollection<Internship> internships,
string lastName, string name, string recruiterId, string userId)
{
var result = _repo.AddEntity(
new Recruiter
{
AspNetUser = aspNetUser,
Bio = bio,
ContactEmail = contactEmail,
Deleted = deleted,
Firm = firm,
FirmId = firmId,
Internships = internships,
LastName = lastName,
Name = name,
RecruiterId = recruiterId,
UserId = userId
});

if (result.Succes)
{
return new LogicResponseHandler<string> { Status = true, Content = "Succes!" };
}
else
{
return new LogicResponseHandler<string> { Status = false, Content = result.Container };
}
}

public LogicResponseHandler<string> UpdateEntity(bool deleted, Firm firm, AspNetUser aspNetUser,
string bio, string contactEmail, string firmId, ICollection<Internship> internships,
string lastName, string name, string recruiterId, string userId)
{
var result = _repo.UpdateEntity(
new Recruiter
{
AspNetUser = aspNetUser,
Bio = bio,
ContactEmail = contactEmail,
Deleted = deleted,
Firm = firm,
FirmId = firmId,
Internships = internships,
LastName = lastName,
Name = name,
RecruiterId = recruiterId,
UserId = userId
});

if (result.Succes)
{
return new LogicResponseHandler<string> { Status = true, Content = "Succes!" };
}
else
{
return new LogicResponseHandler<string> { Status = false, Content = result.Container };
}
}
}
}
Loading

0 comments on commit e56db80

Please sign in to comment.