Beispiel #1
0
        public ActionResult Edit(SmartphoneFeature smartphone, HttpPostedFileBase Imageup)
        {
            if (smartphone.MobileId == 0)
            {
                db.SmartphoneFeatures.Add(smartphone);
            }
            else
            {
                var smartPhone = db.SmartphoneFeatures.Where(s => s.MobileId == smartphone.MobileId).FirstOrDefault();
                smartPhone.Brand           = smartphone.Brand;
                smartPhone.Model           = smartphone.Model;
                smartPhone.Rating          = smartphone.Rating;
                smartPhone.Price           = smartphone.Price;
                smartPhone.ScreenSize      = smartphone.ScreenSize;
                smartPhone.RAM             = smartphone.RAM;
                smartPhone.InternalStorage = smartphone.InternalStorage;
                smartPhone.FrontCamera     = smartphone.FrontCamera;
                smartPhone.RearCamera      = smartphone.RearCamera;
                smartPhone.OS              = smartphone.OS;
                smartPhone.Sim             = smartphone.Sim;
                smartPhone.Sensor          = smartphone.Sensor;
                smartPhone.BatteryCapacity = smartphone.BatteryCapacity;
                smartPhone.Color           = smartphone.Color;
                if (Imageup != null)
                {
                    Imageup.SaveAs(Server.MapPath("/") + "/Content/Image/" + Imageup.FileName);
                    smartphone.Image = "~/Content/Image/" + Imageup.FileName;
                    smartPhone.Image = smartphone.Image;
                }
            }

            db.SaveChanges();
            return(RedirectToAction("SmartphoneList", "SmartphoneFeatures"));
        }
Beispiel #2
0
 public ActionResult Create(SmartphoneFeature smartphone, HttpPostedFileBase Imageup)
 {
     if (smartphone != null)
     {
         if (Imageup != null)
         {
             Imageup.SaveAs(Server.MapPath("/") + "/Content/Image/" + Imageup.FileName);
             smartphone.Image = "~/Content/Image/" + Imageup.FileName;
         }
         db.SmartphoneFeatures.Add(smartphone);
     }
     db.SaveChanges();
     return(RedirectToAction("SmartphoneList", "SmartphoneFeatures"));
 }
        // GET: SmartphoneFeatures/Details/5
        public ActionResult Details(string id)
        {
            ViewBag.Message = "Order Placed Successfully !!! Your Bill Amount is Rs. ";
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SmartphoneFeature smartphoneFeature = db.SmartphoneFeatures.Find(id);

            if (smartphoneFeature == null)
            {
                return(HttpNotFound());
            }
            return(View(smartphoneFeature));
        }
Beispiel #4
0
        public ActionResult Delete(Int16?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SmartphoneFeature smartphone = db.SmartphoneFeatures.Find(id);

            if (smartphone == null)
            {
                return(HttpNotFound());
            }
            db.SmartphoneFeatures.Remove(smartphone);
            db.SaveChanges();

            return(RedirectToAction("SmartphoneList", "SmartphoneFeatures"));
        }
Beispiel #5
0
        // GET: SmartphoneFeatures/Details/5
        public ActionResult Details(Int16 id)
        {
            ViewBag.Message = "Order Placed Successfully !!! Your Bill Amount is Rs. ";
            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SmartphoneFeature smartphoneFeature = db.SmartphoneFeatures.Find(id);

            if (smartphoneFeature == null)
            {
                return(HttpNotFound());
            }

            if (User.IsInRole("admin"))
            {
                return(View("AdminDetails", smartphoneFeature));
            }
            return(View(smartphoneFeature));
        }