public void RemoveCompanyAssociation(Model.Profile.Company.Entity.Company company, Model.Expertise.Entity.Expertise expertise) { try { StandartPersistence standartPersistence = new StandartPersistence(this.Connection); standartPersistence.Execute(CommandType.Text, "DELETE CompanyExpertise WHERE IdCompany = @IdCompany AND IdExpertise = @IdExpertise", new { IdCompany = company.Id, IdExpertise = expertise.IdExpertise }); } catch (Exception e) { throw e; } }
public ActionResult <ObjectResult> Specific(int idExpertise) { try { Model.Expertise.Entity.Expertise expertise = new Model.Expertise.Entity.Expertise(); ExpertiseService expertiseService = new ExpertiseService(Startup.BeePlaceDataBaseConnectionString); expertise = expertiseService.Get(new Model.Expertise.Entity.Expertise() { IdExpertise = idExpertise }); return(StatusCode((int)HttpStatusCode.OK, expertise)); } catch (Exception e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public ActionResult <ObjectResult> RemoveCompanyAssociation([FromBody] CompanyAssociation companyAssociation) { try { ExpertiseService expertiseService = new ExpertiseService(Startup.BeePlaceDataBaseConnectionString); var company = new Model.Profile.Company.Entity.Company() { Id = companyAssociation.IdCompany }; var expertise = new Model.Expertise.Entity.Expertise() { IdExpertise = companyAssociation.IdExpertise }; expertiseService.RemoveCompanyAssociation(company, expertise); return(StatusCode((int)HttpStatusCode.OK, companyAssociation)); } catch (Exception e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public Model.Expertise.Entity.Expertise Get(Model.Expertise.Entity.Expertise expertise) { try { StandartPersistence standartPersistence = new StandartPersistence(this.Connection); expertise = standartPersistence.GetEntities <Model.Expertise.Entity.Expertise>(CommandType.Text, "SELECT IdExpertise, Name, Description, Price, IdFather FROM Expertise WHERE IdExpertise = @IdExpertise", new { IdExpertise = expertise.IdExpertise }).SingleOrDefault(); expertise.Details = new List <ExpertiseDetail>(); expertise.Details = standartPersistence.GetEntities <ExpertiseDetail>(CommandType.Text, "SELECT IdExpertiseDetail, IdExpertise, Title, Description, Image, IdFather FROM ExpertiseDetail WHERE IdExpertise = @IdExpertise", new { IdExpertise = expertise.IdExpertise }).ToList(); return(expertise); } catch (Exception e) { throw e; } }