Пример #1
0
        //Need to test
        public void OfferChange(int offeringId, string filePath, int vkId, decimal price, string description, string title, int categoryId)
        {
            var offering = _offeringRepository.Get(offeringId);

            if (offering == null || offering.User.VkId != vkId)
            {
                return;
            }



            offering.OfferingPhoto.ImagePath = filePath;
            offering.Price       = price;
            offering.Desctiption = description;
            offering.Title       = title;
            if (categoryId != 0)
            {
                offering.OfferingCategoryId = categoryId;
            }


            _offeringRepository.Update(offering);
        }
Пример #2
0
        public void Update(Offering offering)
        {
            if (offering == null)
            {
                throw new ArgumentNullException("offering");
            }

            SetOfferingProperties(offering);

            ValidateOffering(offering);

            offering.Enrollments = (ICollection <Enrollment>)EnrollmentService
                                   .GetEnrollmentsByOfferingId(offering.Id);

            offering.Schedules = (ICollection <Schedule>)ScheduleService
                                 .FindByOfferingId(offering.Id);

            _offeringRepository.Update(offering);
        }