Example #1
0
        public PublisherIsrcSeriesDto AddIsrcByPublisherId(int publisherId, PublisherIsrcViewModel newIsrcSeries)
        {
            var newIsrcSeriesEntry = new organization_isrc_series
            {
                createdby             = "User",
                updatedby             = "User",
                createdon             = DateTime.Now,
                updatedon             = DateTime.Now,
                isactive              = true,
                isrc_countrypart      = _organizationRepository.GetPublisherCountryCodeById(publisherId),
                isrc_lastusednumber   = 0,
                isrc_lastusedyear     = DateTime.Now.Year,
                isrc_organizationpart = newIsrcSeries.IsrcOrganizationPart,
                organizationid        = newIsrcSeries.OrganizationId,
                purposelabel          = "Almenn útgáfa",
            };

            _organizationIsrcSeriesRepository.Add(newIsrcSeriesEntry);
            _unitOfWork.Commit();

            var createdIsrcSeries = _organizationIsrcSeriesRepository.GetAll().OrderByDescending(i => i.id).First();

            return(new PublisherIsrcSeriesDto
            {
                IsrcSeriesId = createdIsrcSeries.id,
                IsrcCountryPart = createdIsrcSeries.isrc_countrypart,
                IsrcOrganizationPart = createdIsrcSeries.isrc_organizationpart,
                LastIsrcNumber = createdIsrcSeries.isrc_lastusednumber,
                OrganizationId = createdIsrcSeries.organizationid,
                PurposeLabel = createdIsrcSeries.purposelabel
            });
        }
 public IHttpActionResult AddIsrcSeriesByPublisherId(int publisherId, [FromBody] PublisherIsrcViewModel newIsrcSeries)
 {
     return(Ok(_organizationService.AddIsrcByPublisherId(publisherId, newIsrcSeries)));
 }