Esempio n. 1
0
        public async Task UpdateHeader(UpdateHeaderReq req, DatabaseContext context)
        {
            var expertProfile = await context.ExpertProfiles
                                .Include(profile => profile.User)
                                .Include(profile => profile.Speciality)
                                .Include(profile => profile.Specialization)
                                .Include(profile => profile.ExpertProfileSkills)
                                .SingleAsync(profile => profile.Id == req.ExpertProfileId);

            if (expertProfile.SpecialityId != req.SpecialityId)
            {
                expertProfile.SpecializationId = null;
                expertProfile.Specialization   = null;
                expertProfile.ExpertProfileSkills.Clear();
            }

            expertProfile.User.DisplayName = req.Name;
            expertProfile.RatePerHour      = req.RatePerHour;
            expertProfile.SpecialityId     = req.SpecialityId;
            expertProfile.SpecializationId = req.SpecializationId;

            if (expertProfile.IsPublished)
            {
                this.ThrowIfPublishingBroken(expertProfile);
            }
        }
Esempio n. 2
0
        public async Task UpdateHeader(UpdateHeaderReq req, DatabaseContext context)
        {
            var currentUserData = this._currentUserService.GetCurrentUserData();

            var company = await context.Companies
                          .SingleAsync(c => c.Id == req.CompanyId && c.UserId == currentUserData.Id);

            company.Name   = req.Name;
            company.CityId = req.CityId;

            if (company.IsPublished)
            {
                this.ThrowIfPublishingBroken(company);
            }
        }
Esempio n. 3
0
        public async Task UpdateHeader(UpdateHeaderReq req, DatabaseContext context)
        {
            var currentUserData = this._currentUserService.GetCurrentUserData();

            var e = await context.Events
                    .SingleAsync(ee => ee.Id == req.EventId && ee.Company.UserId == currentUserData.Id);

            e.Name          = req.Name;
            e.EventTypeId   = req.TypeId;
            e.EventFormatId = req.FormatId;

            if (e.IsPublished)
            {
                this.ThrowIfPublishingBroken(e);
            }
        }
Esempio n. 4
0
        public async Task UpdateHeader(UpdateHeaderReq req, DatabaseContext context)
        {
            var currentUserData = this._currentUserService.GetCurrentUserData();

            var vac = context.Vacancies
                      .Single(v => v.Id == req.VacancyId && v.Event.Company.UserId == currentUserData.Id);

            vac.SpecialityId     = req.SpecialityId;
            vac.SpecializationId = req.SpecializationId;
            vac.Amount           = req.Amount;
            vac.RatePerHour      = req.RatePerHour;

            if (vac.IsPublished)
            {
                this.ThrowIfPublishingBroken(vac);
            }
        }