예제 #1
0
        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;
            }
        }
예제 #2
0
 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));
     }
 }
예제 #3
0
 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));
     }
 }
예제 #4
0
        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;
            }
        }