Exemplo n.º 1
0
        public ActionResult CreatePhone(CreatePhoneModel PhoneModel)
        {
            var phone = ConvertToEntityPhone(PhoneModel);

            phone.Views = 0;
            _adminServices.AddPhone(phone);
            return(RedirectToAction("GetOEMPhones", "Home", PhoneModel.OEMID));
        }
Exemplo n.º 2
0
        public ActionResult PhoneDetails(int id)
        {
            var phone = _basicServices.GetPhone(id, "Manufacturer");
            CreatePhoneModel model = ConvertToPhoneModel(phone);

            if (model != null)
            {
                _basicServices.AddView(phone);
            }
            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult CreatePhone(int oemID = 0)
        {
            CreatePhoneModel phoneModel = new CreatePhoneModel();

            if (oemID != 0)
            {
                phoneModel.OEMID = oemID;
            }
            var items = ConvertToOEMS();
            var list  = items.Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.ID.ToString()
            });

            ViewData["OEMS"] = items;
            return(View());
        }
Exemplo n.º 4
0
 private Phone ConvertToEntityPhone(CreatePhoneModel Model)
 {
     return(new Phone {
         PhoneName = Model.PhoneName,
         Model = Model.Model,
         Resolution = Model.Resolution,
         OS = Model.OS,
         GPU = Model.GPU,
         CPU = Model.CPU,
         BatteryCapacity = Model.BatteryCapacity,
         MainCamera = Model.MainCamera,
         SecondaryCamera = Model.SecondaryCamera,
         OEMID = Model.OEMID,
         Manufacturer = _basicServices.GetManufacturer(Model.OEMID),
         ReleaseDate = Model.RealseDate,
         Price = Model.Price
     });
 }