Exemplo n.º 1
0
        public ActionResult EditMultimedia_PartialView(MultimediaModel multi)
        {
            if (multi.id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (multi == null)
            {
                return(HttpNotFound());
            }
            MultimediaViewModel model = new MultimediaViewModel()
            {
                id = multi.id,
                TitleMultimedia       = multi.Title,
                DescriptionMultimedia = multi.Description,
                TypeMultimedia        = multi.Type,
                TownMultimedia        = multi.Town,
                PriceMultimedia       = multi.Price,
                StreetMultimedia      = multi.Street,
                //  Brand = multi.Brand,
                DateAdd = DateTime.Now,
                SearchOrAskJobMultimedia = multi.SearchOrAskJob,
                listeImage = multi.Images
            };

            return(PartialView(model));
        }
Exemplo n.º 2
0
        public ActionResult IndexRoute(MultimediaViewModel model)
        {
            switch (model.TypeMultimedia)
            {
            case "Informatique":
                return(View("InformaticBrandModel", model));

            case "Consoles de jeux":
                return(View("GameConsoleBrandModel", model));

            case "Jeux video":
                return(View("GameBrandModel", model));

            case "Téléphonie":
                return(View("PhoneBrandModel", model));

            case "Accésoires téléphonie":
                return(View("AddOther", model));

            case "Téléviseur":
                return(View("TvBrandModel", model));

            case "Son":
                return(View("SonBrandModel", model));

            case "Image & Camera vidéo":
                return(View("AddOther", model));

            case "Photocopieuse":
                return(View("AddOther", model));

            default:
                return(View("Autre", model));
            }
        }
Exemplo n.º 3
0
        private async void OnAddFolder(object obj)
        {
            string folderPath = MultimediaViewModel.GetFolderPath("");

            if (!string.IsNullOrEmpty(folderPath))
            {
                await this.dataLibrary.AddContentFromFolder(folderPath, this.contentType);
            }
        }
Exemplo n.º 4
0
        private async void OnAddFiles(object obj)
        {
            switch (this.ContentType)
            {
            case MediaLibrary.DataModels.ContentType.Image:
            {
                string[] filePath = MultimediaViewModel.GetFilePath("", this.imageSearchMask, "Select files to add");
                if (filePath != null)
                {
                    await this.dataLibrary.AddContentFromFiles(filePath, this.contentType);

                    goto case MediaLibrary.DataModels.ContentType.Track;
                }
                else
                {
                    break;
                }
            }

            case MediaLibrary.DataModels.ContentType.Track:
            {
                break;
            }

            case MediaLibrary.DataModels.ContentType.Video:
            {
                string[] strArrays = MultimediaViewModel.GetFilePath("", this.videoSearchMask, "Select files to add");
                if (strArrays != null)
                {
                    await this.dataLibrary.AddContentFromFiles(strArrays, this.contentType);

                    goto case MediaLibrary.DataModels.ContentType.Track;
                }
                else
                {
                    break;
                }
            }

            default:
            {
                goto case MediaLibrary.DataModels.ContentType.Track;
            }
            }
        }
Exemplo n.º 5
0
 public ActionResult SonBrandModel(MultimediaViewModel model)
 {
     return(View(model));
 }
Exemplo n.º 6
0
 public ActionResult  GameConsoleBrandModel(MultimediaViewModel model)
 {
     return(View(model));
 }
Exemplo n.º 7
0
 public ActionResult InformaticBrandModel(MultimediaViewModel model)
 {
     return(View(model));
 }
Exemplo n.º 8
0
        public async Task <ActionResult> EditMultimedia_PartialView(MultimediaViewModel multi, ImageModelView userImage)
        {
            List <string> brandList = new List <string>();

            brandList.Add(multi.BrandConsoleGame);
            brandList.Add(multi.BrandInformatiquePhotocopi);

            brandList.Add(multi.BrandPhoneAccesories);
            brandList.Add(multi.BrandSon);
            brandList.Add(multi.BrandTv);

            string Brand = null;

            foreach (var brand in brandList)
            {
                if (brand != null)
                {
                    Brand = brand;
                }
            }
            List <string> ModeleList = new List <string>();

            ModeleList.Add(multi.ModelAlcatelPhoneAccesorie);
            ModeleList.Add(multi.ModelApplePhoneAccesorie);
            ModeleList.Add(multi.ModelAzusPhoneAccesorie);
            ModeleList.Add(multi.ModelConsoleGame);
            ModeleList.Add(multi.ModelHonorPhoneAccesorie);
            ModeleList.Add(multi.ModelHTCPhoneAccesorie);
            ModeleList.Add(multi.ModelHuaweiPhoneAccesorie);
            ModeleList.Add(multi.ModelInformatiquePhotocopy);
            ModeleList.Add(multi.ModelLenovoPhoneAccesorie);
            ModeleList.Add(multi.ModelLGPhoneAccesorie);
            ModeleList.Add(multi.ModelMicrosoftPhoneAccesorie);
            ModeleList.Add(multi.ModelMotorolaPhoneAccesorie);
            ModeleList.Add(multi.ModelOnePlusPhoneAccesorie);
            ModeleList.Add(multi.ModelOtherMultimedia);
            ModeleList.Add(multi.ModelSamsungPhoneAccesorie);
            ModeleList.Add(multi.ModelSon);
            ModeleList.Add(multi.ModelSonyPhoneAccesorie);
            ModeleList.Add(multi.ModelTV);
            ModeleList.Add(multi.ModelWikoPhoneAccesorie);
            ModeleList.Add(multi.ModelXaomiPhoneAccesorie);
            ModeleList.Add(multi.ModelZTEPhoneAccesorie);

            string Model = null;

            foreach (var model in ModeleList)
            {
                if (model != null)
                {
                    Model = model;
                }
            }

            if (ModelState.IsValid)
            {
                string          userId = User.Identity.GetUserId();
                ApplicationUser user   = dal.GetUserByStrId(userId);
                MultimediaModel model  = new MultimediaModel()
                {
                    id             = multi.id,
                    Title          = multi.TitleMultimedia,
                    Description    = multi.DescriptionMultimedia,
                    Type           = multi.TypeMultimedia,
                    Town           = multi.TownMultimedia,
                    Price          = multi.PriceMultimedia,
                    Street         = multi.StreetMultimedia,
                    Brand          = Brand,
                    Model          = Model,
                    DateAdd        = DateTime.Now,
                    SearchOrAskJob = multi.SearchOrAskJobMultimedia,
                    Category       = new CategoryModel {
                        CategoryName = "Multimedia"
                    },
                    User = user
                };

                using (var httpClient = new HttpClient())
                {
                    var fullAddress = $"{model.Street}";
                    var response    = await httpClient.GetAsync("https://api.opencagedata.com/geocode/v1/json?q=" + fullAddress + "&key=a196040df44a4a41a471173aed07635c");

                    if (response.IsSuccessStatusCode)
                    {
                        var jsonn = await response.Content.ReadAsStringAsync();

                        var joo  = JObject.Parse(jsonn);
                        var latt = (string)joo["results"][0]["geometry"]["lat"];
                        var lonn = (string)joo["results"][0]["geometry"]["lng"];

                        List <ImageProcductModel> images = ImageEdit(userImage, model);

                        model.Images = images;

                        dal.EditMultimedia(model, latt, lonn);


                        return(RedirectToAction("GetListProductByUser_PartialView", "User"));
                    }
                }
            }
            return(View(multi));
        }
Exemplo n.º 9
0
        public async Task <ActionResult> AddMultimedia(MultimediaViewModel multi, ImageModelView userImage)
        {
            List <string> brandList = new List <string>();

            brandList.Add(multi.BrandConsoleGame);
            brandList.Add(multi.BrandInformatiquePhotocopi);

            brandList.Add(multi.BrandPhoneAccesories);
            brandList.Add(multi.BrandSon);
            brandList.Add(multi.BrandTv);

            string Brand = null;

            foreach (var brand in brandList)
            {
                if (brand != null)
                {
                    Brand = brand;
                }
            }
            List <string> ModeleList = new List <string>();

            ModeleList.Add(multi.ModelAlcatelPhoneAccesorie);
            ModeleList.Add(multi.ModelApplePhoneAccesorie);
            ModeleList.Add(multi.ModelAzusPhoneAccesorie);
            ModeleList.Add(multi.ModelConsoleGame);
            ModeleList.Add(multi.ModelHonorPhoneAccesorie);
            ModeleList.Add(multi.ModelHTCPhoneAccesorie);
            ModeleList.Add(multi.ModelHuaweiPhoneAccesorie);
            ModeleList.Add(multi.ModelInformatiquePhotocopy);
            ModeleList.Add(multi.ModelLenovoPhoneAccesorie);
            ModeleList.Add(multi.ModelLGPhoneAccesorie);
            ModeleList.Add(multi.ModelMicrosoftPhoneAccesorie);
            ModeleList.Add(multi.ModelMotorolaPhoneAccesorie);
            ModeleList.Add(multi.ModelOnePlusPhoneAccesorie);
            ModeleList.Add(multi.ModelOtherMultimedia);
            ModeleList.Add(multi.ModelSamsungPhoneAccesorie);
            ModeleList.Add(multi.ModelSon);
            ModeleList.Add(multi.ModelSonyPhoneAccesorie);
            ModeleList.Add(multi.ModelTV);
            ModeleList.Add(multi.ModelWikoPhoneAccesorie);
            ModeleList.Add(multi.ModelXaomiPhoneAccesorie);
            ModeleList.Add(multi.ModelZTEPhoneAccesorie);

            string Model = null;

            foreach (var modell in ModeleList)
            {
                if (modell != null)
                {
                    Model = modell;
                }
            }


            bool isLookAuKwat = false;
            bool isParticuler = false;
            bool isPromotion  = false;

            if (User.IsInRole(MyRoleConstant.RoleAdmin) || (User.IsInRole(MyRoleConstant.Role_SuperAgent)))
            {
                isLookAuKwat = true;
                isPromotion  = true;
            }
            else
            {
                isParticuler = true;
            }

            if (multi.Stock == 0)
            {
                multi.Stock = 1;
            }

            MultimediaModel model = new MultimediaModel()
            {
                id             = multi.id,
                Title          = multi.TitleMultimedia,
                Description    = multi.DescriptionMultimedia,
                Type           = multi.TypeMultimedia,
                Town           = multi.TownMultimedia,
                Price          = multi.PriceMultimedia,
                Street         = multi.StreetMultimedia,
                Brand          = Brand,
                Model          = Model,
                Capacity       = multi.Capacity,
                DateAdd        = DateTime.Now,
                SearchOrAskJob = multi.SearchOrAskJobMultimedia,
                IsActive       = true,
                IsLookaukwat   = isLookAuKwat,
                IsParticulier  = isParticuler,
                IsPromotion    = isPromotion,
                Provider_Id    = multi.Provider_Id,
                Stock_Initial  = multi.Stock,
                Stock          = multi.Stock,
                ProductCountry = multi.ProductCountry,
            };
            string success = null;

            if (ModelState.IsValid)
            {
                using (var httpClient = new HttpClient())
                {
                    string          userId = User.Identity.GetUserId();
                    ApplicationUser user   = dal.GetUserByStrId(userId);

                    var fullAddress = $"{ model.Street /*+ model.Town + "," + ",Cameroon"*/}";
                    var response    = await httpClient.GetAsync("https://api.opencagedata.com/geocode/v1/json?q=" + fullAddress + "&key=a196040df44a4a41a471173aed07635c");

                    if (response.IsSuccessStatusCode)
                    {
                        var jsonn = await response.Content.ReadAsStringAsync();

                        var joo  = JObject.Parse(jsonn);
                        var latt = (string)joo["results"][0]["geometry"]["lat"];
                        var lonn = (string)joo["results"][0]["geometry"]["lng"];

                        List <ImageProcductModel> images = ImageAdd(userImage);

                        model.Images   = images;
                        model.User     = user;
                        model.Category = new CategoryModel {
                            CategoryName = "Multimedia"
                        };
                        dal.AddMultimedia(model, latt, lonn);
                        //check if email or phone is confirm and update date of publish announce for agent pay
                        if ((user.EmailConfirmed == true || user.PhoneNumberConfirmed == true) && user.Date_First_Publish == null)
                        {
                            dal.Update_Date_First_Publish(user);
                        }

                        // success = "Annonce ajoutée avec succès dans la liste !";
                        //return RedirectToAction("UserProfile", "Home", new { message = success });
                        // return RedirectToAction("GetListProductByUser_PartialView", "User");
                        return(RedirectToAction("AddImage", "Job", new { id = model.id }));
                    }
                }
            }
            success = "Désolé une erreur s'est produite!";
            return(RedirectToAction("UserProfile", "Home", new { message = success }));
        }
Exemplo n.º 10
0
 public ActionResult AddFullModel(MultimediaViewModel model)
 {
     return(View(model));
 }
Exemplo n.º 11
0
 public ActionResult Autre(MultimediaViewModel model)
 {
     return(View(model));
 }
Exemplo n.º 12
0
 public ActionResult AddOther(MultimediaViewModel model)
 {
     return(View(model));
 }