Exemplo n.º 1
0
 public async Task <IActionResult> AddProduct([FromBody] MobileViewModel model)
 {
     //var _apiClient = ApiClientFactory.RestClient;
     //var result = await _apiClient.PostAsync<object>(_apiClient.CreateRequestUri("Products"), model);
     //throw new Exception();
     return(View());
 }
        // GET: Detail
        public ActionResult Index(int id)
        {
            MobileDAO       MobileDAO = new MobileDAO();
            MobileViewModel Mobile    = MobileDAO.GetMobileViewModelById(id);

            return(View(Mobile));
        }
Exemplo n.º 3
0
        public void ListViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)

        {
            MobileViewModel mvm = (MobileViewModel)((ListViewItem)sender).DataContext;

            mvm.ShowMobileView();
        }
Exemplo n.º 4
0
        public Task <BaseResponse> Put(int id, [FromBody] MobileViewModel model)
        {
            MobileListItem updateModel = new MobileListItem
            {
                Brand            = model.Brand,
                CPU              = model.CPU,
                InternalMemory   = model.InternalMemory,
                Name             = model.Name,
                OS               = model.OS,
                Price            = model.Price,
                RAM              = model.RAM,
                ScreenResolution = model.ScreenResolution,
                ScreenSize       = model.ScreenSize,
                Size             = model.Size,
                VideoUrl         = model.VideoUrl,
                Weight           = model.Weight
            };

            foreach (var item in model.Photos)
            {
                Domain.DTO.ServiceModels.Photo photo = new Domain.DTO.ServiceModels.Photo
                {
                    Base64  = item.Base64,
                    PhotoId = item.PhotoId
                };
                updateModel.Photos.Add(photo);
            }

            return(_mobileService.UpdateMobile(updateModel));
        }
        public ActionResult Index()
        {
            var model = new MobileViewModel
            {
                Description = "Our mobile app is available for iPhone and Android devices. Through the app, a physician is able to obtain his patient schedule, perform dictation, and review transcription. Dictations are sent to the system via the WiFi or Cellular data network for which the device is configured, allowing dictations to get to the medical transcriptionist or language specialist as quickly as possible. The apps can be downloaded to an iPhone, iPod Touch or iPad via the Apple App Store, or to an Android phone or tablet via the Google Play Store. Documentation for installing and using the applications are at the links below:",
                ManualLinks = new List <HyperLink>
                {
                    new HyperLink
                    {
                        NavigateUrl = Url.Action("Index", "Download", new { fileName = "eScription One Mobile Android Manual October 2020.pdf" }),
                        Text        = "Android Installation and User Manual"
                    },
                    new HyperLink
                    {
                        NavigateUrl = Url.Action("Index", "Download", new { fileName = "eScription One iOS Manual November 2020.pdf" }),
                        Text        = "iPhone Installation and User Manual"
                    },
                    new HyperLink
                    {
                        NavigateUrl = Url.Action("Index", "Download", new { fileName = "How to Log in Using MFA for InQuiry, InSync, and Mobile Apps.pdf" }),
                        Text        = "How to Login Using MFA"
                    }
                }
            };

            return(View(model));
        }
Exemplo n.º 6
0
 public ActionResult Update(MobileViewModel mobileViewModel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ViewBag.brands = new SelectList(brandBL.GetBrand(), "BrandId", "BrandName");
             var config = new MapperConfiguration(mapping =>
             {
                 mapping.CreateMap <MobileViewModel, Mobile>();
             });
             IMapper mapper = config.CreateMapper();
             var     mobile = mapper.Map <MobileViewModel, Mobile>(mobileViewModel);
             mobileBL.UpdateMobile(mobile);
             return(RedirectToAction("Display"));
         }
         else
         {
             ModelState.AddModelError("", "Some error occurred");
             return(View());
         }
     }
     catch
     {
         return(RedirectToAction("Error", "Error"));
     }
 }
Exemplo n.º 7
0
        public async Task <RepositoryResponse <MobileViewModel> > Save([FromBody] JObject data, string name)
        {
            var getAttr = await Lib.ViewModels.MixAttributeSets.ReadViewModel.Repository.GetSingleModelAsync(m => m.Name == name);

            if (data != null && getAttr.Data != null)
            {
                var vm = new MobileViewModel()
                {
                    AttributeSetName = getAttr.Data.Name,
                    AttributeSetId   = getAttr.Data.Id,
                    Data             = data
                };
                vm.Specificulture = _lang;
                var result = await base.SaveAsync <MobileViewModel>(vm, true);

                if (result.IsSucceed)
                {
                    MixService.LoadFromDatabase();
                    MixService.SaveSettings();
                }
                return(result);
            }
            return(new RepositoryResponse <MobileViewModel>()
            {
                Status = 501
            });
        }
Exemplo n.º 8
0
        public ActionResult New()
        {
            DropDowns dropDowns = new DropDowns()
            {
                Batteries        = batteryService.FindAll(),
                Cameras          = cameraService.FindAll(),
                Memories         = memoryService.FindAll(),
                Shops            = shopService.FindAll(),
                OperativeSystems = operativeSystemService.FindAll(),
                Rams             = ramService.FindAll()
            };

            MobileViewModel mobileViewModel = new MobileViewModel()
            {
                DropDowns = dropDowns,
                Mobile    = new NewMobileDTO()
                {
                    Mobile = new MobileM(),
                    Images = new List <HttpPostedFileBase>(),
                }
            };


            return(View(mobileViewModel));
        }
Exemplo n.º 9
0
        public async Task <ActionResult> Create()
        {
            //HttpContext.Server.ScriptTimeout = 300000000;
            //var brandResult = await _brandBusinessService.RetrieveBrands();
            //var mobileResult = await _mobileBusinessService.RetrieveMobiles();
            //GetGoogleImages("nokia 6");
            //var number = 255;
            //var singleBrand = brandResult.Items.Where(e => e.BrandId == number).ToList();
            //foreach (var item in singleBrand)
            //{
            //    var newList = new List<Brand>() { item };
            //    var mobileList = CreateMobileData(newList);
            //    await _mobileBusinessService.CreateMobile(mobileList);
            //}

            //foreach (var item in brandResult.Items.Where(e => e.BrandId == 300).ToList())
            //{
            //    var brandMobile = mobileResult.Items.Where(e => e.BrandId == item.BrandId).ToList();
            //    var mobileImageList = CreateMobileImageData(item, brandMobile);
            //    await _mobileBusinessService.CreateMobileImage(mobileImageList);

            //}

            var brands = await _brandBusinessService.RetrieveBrands(e => true);

            var brandList = brands.Items.ToList();
            var viewModel = new MobileViewModel()
            {
                Mobile = new Business.Models.Mobile(),
                Brands = new SelectList(brandList, "BrandId", "Name")
            };

            return(View(viewModel));
        }
Exemplo n.º 10
0
        public async Task <BaseResponse> Post([FromBody] MobileViewModel model)
        {
            InsertMobileModel insertModel = new InsertMobileModel
            {
                Brand            = model.Brand,
                CPU              = model.CPU,
                InternalMemory   = model.InternalMemory,
                Name             = model.Name,
                OS               = model.OS,
                Price            = model.Price,
                RAM              = model.RAM,
                ScreenResolution = model.ScreenResolution,
                ScreenSize       = model.ScreenSize,
                Size             = model.Size,
                VideoUrl         = model.VideoUrl,
                Weight           = model.Weight
            };

            foreach (var item in model.Photos)
            {
                Domain.DTO.ServiceModels.Photo photo = new Domain.DTO.ServiceModels.Photo
                {
                    Base64  = item.Base64,
                    PhotoId = item.PhotoId
                };
                insertModel.Photos.Add(photo);
            }

            return(await _mobileService.InsertMobile(insertModel));
        }
 public ActionResult Create(MobileViewModel MobileCreate)
 {
     ViewBag.ListCategory = HttpContext.Cache[Constants.LIST_CATEGORY];//After Post, Model losses the initialized values, and it will have only values which are getting posted along with the Form i.e. input or hidden fields. Make sure you reinitialize the model before passing it to view.
     if (ModelState.IsValid)
     {
         var CategoryDao = new CategoryDAO();
         int CategoryId  = CategoryDao.GetCategoryId(MobileCreate.CategoryName);
         var Mobile      = new Mobile
         {
             Name       = MobileCreate.Name,
             Image      = MobileCreate.Image,
             Price      = MobileCreate.Price,
             Quantity   = MobileCreate.Quantity,
             CategoryId = CategoryId,
             Status     = MobileCreate.Status,
             CreateTime = DateTime.Now,
         };
         var dao = new MobileDAO();
         dao.InsertMobile(Mobile);
         TempData["ChangeStatus"] = "Create successful !";
     }
     else
     {
         return(View());
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 12
0
        public ActionResult Edit(MobileViewModel MobileVM, IEnumerable <HttpPostedFileBase> files)
        {
            var city = db.Cities.Find(MobileVM.CityId);

            if (ModelState.IsValid)
            {
                var Mobile = db.Mobiles.Find(MobileVM.Id);
                var pics   = Mobile.Ad.Pictures;

                var pictures = new List <Picture>();

                foreach (var file in files)
                {
                    if (file != null && file.ContentLength > 0 && files.FirstOrDefault() != null)
                    {
                        string filName = Guid.NewGuid() + Path.GetFileName(file.FileName);
                        pictures.Add(new Picture {
                            PictureURL = filName, AdId = Mobile.AdId
                        });
                        file.SaveAs(Path.Combine(Server.MapPath("/Uploads/"), filName));
                    }
                }



                Mobile.Ad.AdDescribtion = MobileVM.AdDescribtion;
                Mobile.Ad.AdTitle       = MobileVM.AdTitle;
                Mobile.Ad.AdPrice       = MobileVM.AdPrice;
                Mobile.Ad.City          = city;
                Mobile.AdId             = MobileVM.Id;

                Mobile.MobileCompany    = MobileVM.MobileCompany;
                Mobile.MobileRam        = MobileVM.MobileRam;
                Mobile.MobileStorage    = MobileVM.MobileStorage;
                Mobile.MobileScreenSize = MobileVM.MobileScreenSize;
                Mobile.MobileCpu        = MobileVM.MobileCpu;
                Mobile.MobileOS         = MobileVM.MobileOS;
                Mobile.MobileColor      = MobileVM.MobileColor;
                Mobile.MobileBattery    = MobileVM.MobileBattery;
                Mobile.MobileStatus     = MobileVM.MobileStatus;
                Mobile.CDMA_GSM         = MobileVM.CDMA_GSM;
                Mobile.MobileCamera     = MobileVM.MobileCamera;
                Mobile.OTG = MobileVM.OTG;

                if (pictures.Count() > 0)
                {
                    Mobile.Ad.Pictures.AddRange(pictures);
                }



                db.Entry(Mobile).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("MyAds", "Ads"));
            }
            ViewBag.CityId = new SelectList(db.Cities, "Id", "Name", MobileVM.CityId);
            return(View(MobileVM));
        }
Exemplo n.º 13
0
        public async Task <IActionResult> Get()
        {
            MobileViewModel mobileView = new MobileViewModel
            {
                Categories     = new List <MockCategory>(),
                Contents       = new List <MockContent>(),
                Advertisements = new List <MockAdvertisement>()
            };
            var navigation = await _context.Category.Include(c => c.Contents).Include(a => a.Advertisements).ToListAsync();

            var contents      = navigation.FirstOrDefault().Contents.ToList();
            var advertisments = navigation.FirstOrDefault().Advertisements.ToList();

            foreach (var nav in navigation)
            {
                mobileView.Categories.Add(new MockCategory {
                    CategoryName = nav.CategoryName, ID = nav.ID
                });
            }
            foreach (var content in contents)
            {
                mobileView.Contents.Add(new MockContent
                {
                    ID               = content.ID,
                    CategoryID       = content.CategoryID,
                    ContentTitle     = content.ContentTitle,
                    DateEdited       = content.DateEdited,
                    DatePublished    = content.DatePublished,
                    ImageUrl         = $"https://www.uturuabianews.com/{content.ImageUrl}",
                    LongDescription  = content.LongDescription,
                    NoOfComments     = content.NoOfComments,
                    NoOfLikes        = content.NoOfLikes,
                    NoOfViews        = content.NoOfViews,
                    ShortDescription = content.ShortDescription,
                    VideoUrl         = content.VideoUrl
                });
            }
            foreach (var advert in advertisments)
            {
                var duration = advert.EndDate - DateTime.Now;
                if (DateTime.Now <= advert.EndDate && duration > TimeSpan.Zero)
                {
                    mobileView.Advertisements.Add(new MockAdvertisement
                    {
                        ID = advert.ID,
                        AdvertDescription = advert.AdvertDescription,
                        AdvertImage       = advert.AdvertImage,
                        AdvertName        = advert.AdvertName,
                        CategoryID        = advert.CategoryID
                    });
                }
            }



            return(Json(mobileView));
        }
Exemplo n.º 14
0
        // GET: Mobile
        public ActionResult Create()
        {
            MobileViewModel MobileVm = new MobileViewModel()
            {
                Gategories = db.Categories,
                mobile     = new Mobile()
            };

            return(View(MobileVm));
        }
Exemplo n.º 15
0
        /// <summary>
        /// Delete an entity.
        /// </summary>
        /// <param name="model"></param>
        public void Delete(MobileViewModel model)
        {
            var entity = model.ToEntity();

            this._MobilesRepository.Delete(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion
        }
Exemplo n.º 16
0
        public ActionResult MobileRegister()
        {
            MobileModels MobileModel = new MobileModels();

            var brand = MobileModel.GetBrand();

            ViewBag.brand = brand;
            MobileViewModel MobileVM = new MobileViewModel();

            return(View(MobileVM));
        }
Exemplo n.º 17
0
        public Mobile ConvertMobileViewToMobile(MobileViewModel MobileVM)
        {
            Mobile AMobile = new Mobile();

            AMobile.Name           = MobileVM.Name;
            AMobile.ProductionDate = MobileVM.ProductionDate;
            AMobile.BrandId        = MobileVM.BrandId;
            AMobile.Weight         = MobileVM.Weight;
            AMobile.Otg            = MobileVM.Otg;

            return(AMobile);
        }
Exemplo n.º 18
0
        public ActionResult Create(MobileViewModel mob)
        {
            Mobile mobile = new Mobile();

            mobile.UserId       = User.Identity.GetUserId();
            mobile.MobileNumber = mob.mobile.MobileNumber;
            mobile.CtegoryId    = mob.mobile.CtegoryId;
            mobile.Balance      = db.Categories.SingleOrDefault(x => x.CategoryId == mob.mobile.CtegoryId).CategoryBalance;
            db.mobiles.Add(mobile);
            db.SaveChanges();
            return(RedirectToAction("SendSms", "SendSms"));
        }
        public async Task <ActionResult <MobileViewModel> > Save(string culture, [FromBody] MobileViewModel data)
        {
            var portalResult = await base.SaveAsync <MobileViewModel>(data, true);

            if (portalResult.IsSucceed)
            {
                return(Ok(portalResult));
            }
            else
            {
                return(BadRequest(portalResult));
            }
        }
Exemplo n.º 20
0
        private void button1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MobileViewModel mvm = (MobileViewModel)((Button)sender).DataContext;

            if (String.IsNullOrEmpty(deviceCommands.Text))
            {
                MessageBox.Show("No hay comandos a enviar.");
                return;
            }
            String[] commands = deviceCommands.Text.Split('\n');
            mvm.SendCommands(commands);
            MessageBox.Show("Se enviaron los comandos indicados");
            deviceCommands.Text = "";
        }
Exemplo n.º 21
0
        /// <summary>
        /// Throw an exception if name is exist.
        /// </summary>
        /// <param name="model">Mobile view model</param>
        public void ThrowExceptionIfExist(MobileViewModel model)
        {
            ConditionFilter <Mobile, long> condition = new ConditionFilter <Mobile, long>
            {
                Query = (entity =>
                         entity.Name == model.Name &&
                         entity.Id != model.Id)
            };
            var existEntity = this._MobilesRepository.Get(condition).FirstOrDefault();

            if (existEntity != null)
            {
                throw new ItemAlreadyExistException();
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Update an entity.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public MobileViewModel Update(MobileViewModel model)
        {
            this.ThrowExceptionIfExist(model);

            var entity = model.ToEntity();

            entity = this._MobilesRepository.Update(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion

            model = entity.ToModel();
            return(model);
        }
Exemplo n.º 23
0
        public ActionResult MobileRegister(MobileViewModel MobileView)
        {
            MobileModels MobileModel = new MobileModels();
            var          AMobile     = MobileModel.ConvertMobileViewToMobile(MobileView);

            MobileModel.InsertMobile(AMobile);

            var brand = MobileModel.GetBrand();

            ViewBag.brand = brand;

            DateTimeConvert DateModel = new DateTimeConvert();
            var             dateText  = DateModel.ConvertDateTimeToString(MobileView.ProductionDate);

            MobileView.DateText = dateText;

            return(View(MobileView));
        }
        public ActionResult Edit(MobileViewModel Mobile, double OldPrice, int OldQuantity, string OldImage)
        {
            ViewBag.ListCategory = HttpContext.Cache[Constants.LIST_CATEGORY];
            var CategoryDao = new CategoryDAO();
            int CategoryId  = CategoryDao.GetCategoryId(Mobile.CategoryName);

            if (ModelState.IsValid)
            {
                if (string.IsNullOrEmpty(Mobile.Image))
                {
                    Mobile.Image = OldImage;
                }
                var dao = new MobileDAO();
                dao.EditMobile(new Mobile {
                    MobileId   = Mobile.MobileId,
                    Name       = Mobile.Name,
                    Image      = Mobile.Image,
                    Price      = Mobile.Price,
                    Quantity   = Mobile.Quantity,
                    Status     = Mobile.Status,
                    CategoryId = CategoryId
                });
                var  UpdateDao = new UpdateTableDAO();
                bool check     = UpdateDao.InsertUpdateTable(new UpdateTable
                {
                    MobileId     = Mobile.MobileId,
                    OldPrice     = OldPrice,
                    OldQuantity  = OldQuantity,
                    NewPrice     = Mobile.Price,
                    NewQuantity  = Mobile.Quantity,
                    StatusUpdate = "Edit",
                    Email        = ((AccountLogin)Session[Constants.USER_SESSION]).Email,
                    TimeUpdate   = DateTime.Now,
                });
                TempData["ChangeStatus"] = "Update Successful !";
            }
            else
            {
                ModelState.AddModelError("", "Update is not Successful !");
                return(View("Edit"));
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 25
0
        public async Task <ActionResult> Create(MobileViewModel mobileViewModel)
        {
            if (ModelState.IsValid)
            {
                //Create Apartment
                var result = await _mobileBusinessService.CreateMobile(mobileViewModel.Mobile);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }
                ModelState.AddModelError("", result.Exception);
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError("", error);
                }
            }
            return(View(mobileViewModel));
        }
Exemplo n.º 26
0
        public IActionResult AddMobile(MobileViewModel request)
        {
            if (ModelState.IsValid)
            {
                Phone mobile = new Phone()
                {
                    Name         = request.Name,
                    Manufacturer = _manufacturerService.GetManufacturerById(request.ManufacturerId),
                    Price        = request.Price
                };


                _mobileService.AddMobile(mobile);

                return(Ok());
            }

            return(BadRequest());
        }
        public async Task <RepositoryResponse <MobileViewModel> > Save([FromBody] MobileViewModel data)
        {
            if (data != null)
            {
                data.Specificulture = _lang;
                var result = await base.SaveAsync <MobileViewModel>(data, true);

                if (result.IsSucceed)
                {
                    MixService.LoadFromDatabase();
                    MixService.SaveSettings();
                }
                return(result);
            }
            return(new RepositoryResponse <MobileViewModel>()
            {
                Status = 501
            });
        }
Exemplo n.º 28
0
        public List <MobileViewModel> ConvertMobileToViewModel(List <Mobile> MobileEntity)
        {
            List <MobileViewModel> brandViewList = new List <MobileViewModel>();

            foreach (var item in MobileEntity)
            {
                MobileViewModel MobileVM = new MobileViewModel();

                MobileVM.Name           = item.Name;
                MobileVM.ProductionDate = item.ProductionDate;
                MobileVM.BrandId        = item.BrandId;
                MobileVM.Weight         = item.Weight;
                MobileVM.Otg            = item.Otg.HasValue == false ? false : item.Otg.Value;
                MobileVM.BrandName      = item.Brand.BrandName;

                brandViewList.Add(MobileVM);
            }
            return(brandViewList);
        }
Exemplo n.º 29
0
        public IActionResult Index()
        {
            ViewData["Title"] = "منافساتي";
            var Count     = 0;
            var viewModel = new MobileViewModel()
            {
                StatusCount = new int[100]
            };

            viewModel.status    = data.GetAll();
            viewModel.engineers = engineerData.GetAll();
            foreach (var item in viewModel.status)
            {
                viewModel.StatusCount[Count] = monafasaData.GetByStatu(item.Id).Count();
                Count++;
            }
            viewModel.Count = 0;
            return(View(viewModel));
        }
Exemplo n.º 30
0
 public ActionResult Create(MobileViewModel mobileViewModel)
 {
     try
     {
         ViewBag.brands = new SelectList(brandBL.GetBrand(), "BrandId", "BrandName");
         if (ModelState.IsValid)
         {
             var config = new MapperConfiguration(mapping =>
             {
                 mapping.CreateMap <MobileViewModel, Mobile>();
             });
             IMapper mapper = config.CreateMapper();
             var     mobile = mapper.Map <MobileViewModel, Mobile>(mobileViewModel);
             //Mobile mobile = new Mobile();
             ////mobile.BrandName = mobileViewModel.BrandName;
             //mobile.Id = mobileViewModel.Id;
             //mobile.BatteryCapacity = mobileViewModel.BatteryCapacity;
             //mobile.Color = mobileViewModel.Color;
             //mobile.DisplaySize = mobileViewModel.DisplaySize;
             //mobile.MobileModel = mobileViewModel.MobileModel;
             //mobile.Pixel = mobileViewModel.Pixel;
             //mobile.Price = mobileViewModel.Price;
             //mobile.Processor = mobileViewModel.Processor;
             //mobile.RAM = mobileViewModel.RAM;
             //mobile.Slimness = mobileViewModel.Slimness;
             //mobile.Storage = mobileViewModel.Storage;
             mobileBL.CreateMobile(mobile);
             ViewBag.Message = "Mobile details added";
             ModelState.Clear();
             return(RedirectToAction("Display"));
         }
         else
         {
             ModelState.AddModelError("", "Some error occurred");
             return(View(mobileViewModel));
         }
     }
     catch
     {
         return(RedirectToAction("Error", "Error"));
     }
 }