public BusinessLayerResult <Video> VideoYukle(VideoViewModel model)
        {
            string CountryName = RegionInfo.CurrentRegion.DisplayName;

            video = Find(x => x.videoTitle == model.videoTitle && x.videoText == model.videoText);
            TimeSpan duration = new TimeSpan(0, 0, 0, 5, 0);

            if (model.duration < duration)
            {
                res.AddError(ErrorMessageCode.VideoDurationLimit, "Yükleyeceğiniz video en az 5 saniye olmalıdır.");
            }
            if (video != null)
            {
                res.AddError(ErrorMessageCode.PostKayitli, "Oluşturacağınız gönderinin başka gönderiyle aynı olmaması lazım.");
            }
            else
            {
                content = cManager.Find(x => x.contentName == model.content);
                country = ctryManager.Find(x => x.CountryName == CountryName);
                if (country == null && CountryName != null)
                {
                    country             = new Country();
                    country.CountryName = CountryName;
                    ctryManager.Insert(country);
                    country = ctryManager.Find(x => x.CountryName == CountryName);
                }
                int dbResult = Insert(new Video()
                {
                    videoTitle   = model.videoTitle,
                    videoText    = model.videoText,
                    duration     = model.duration,
                    video        = model.videoName,                   //Kaydedilen Videonun Adı (Örn. belgesel.mp4)
                    frame        = model.frameName,                   //Kaydedilen Frame Adı (Örn. belgesel.jpeg)
                    approved     = false,                             //Onaylı mı?
                    sharingDate  = DateTime.Now.AddHours(10),         //Paylaşılma Tarihi
                    contentId    = content.contentId,                 //KategoriId
                    goruntulenme = 0,                                 //Görüntülenme Sayısı
                    like         = 0,                                 //Beğeni Sayısı
                    dislike      = 0,                                 //Beğenilmeme Sayısı
                    memberId     = App.Common.GetCurrentUsernameId(), //Videoyu paylaşan UyeId
                    CountryID    = country.CountryID                  //Paylaşıldığı bölge, UlkeId
                });
                if (dbResult > 0)
                {
                    res.Result = Find(x => x.videoTitle == model.videoTitle && x.videoText == model.videoText && x.duration == model.duration);
                }
            }
            return(res);
        }
Ejemplo n.º 2
0
        public static Continent ContinentInMapper(CountryManager countryManager, ContinentInApi continentIn)
        {
            Continent continent = new Continent();

            continent.Name = continentIn.Name;
            if (continentIn.Countries != null)
            {
                foreach (var countryId in continentIn.Countries)
                {
                    Country country = countryManager.Find(countryId);
                    continent.AddCountry(country);
                }
            }
            return(continent);
        }
Ejemplo n.º 3
0
 public ActionResult <CountryOutApi> GetCountry(int continentId, int countryId)
 {
     logger.LogInformation(countryId, $"Get api/continent/{continentId}/country/{countryId} called");
     try
     {
         if (continentManager.Find(continentId) != null && countryManager.Find(countryId) != null &&
             countryManager.Find(countryId).Continent.Id == continentId)
         {
             Domain.Models.Country country    = countryManager.Find(continentId, countryId);
             CountryOutApi         countryOut = CountryMapper.CountryOutMapper(hostUrl, country);
             return(Ok(countryOut));
         }
         else
         {
             logger.LogError($"Country with id{countryId} is not found");
             return(NotFound($"Country with id{countryId} is not found"));
         }
     }
     catch (Exception ex)
     {
         logger.LogError(ex.Message);
         return(NotFound(ex.Message));
     }
 }