Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SimCards simCards = db.SimCards.Find(id);

            db.SimCards.Remove(simCards);
            db.SaveChanges();
            return(RedirectToAction("Index", "SimCards"));
        }
Ejemplo n.º 2
0
        public ActionResult DisableService(int id)
        {
            Users    user = DbContext.Users.ToList().Where(u => u.IdCard.Equals(Session["userId"])).First();
            SimCards card = DbContext.SimCards.Where(c => c.CustomerId.Equals(user.IdCard)).First();

            DbContext.SimServices.Where(ss => ss.SimId.Equals(card.SimId) && ss.StatusCode == 1 && ss.ServiceId == id).First().StatusCode = 0;
            DbContext.SaveChanges();
            return(Redirect("/Home/Cabinet"));
        }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "SIMCardID,SIMBatchID,SerialNumber,MobileNumber,ActivatedOn,IsAvailable,IsActive")] SimCards m)
 {
     if (ModelState.IsValid)
     {
         db.Entry(m).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "SimCards"));
     }
     ViewBag.SIMBatchID = new SelectList(db.SimCardBatches, "SimBatchID", "BatchReference", m.SIMBatchID);
     return(View(m));
 }
Ejemplo n.º 4
0
 public ActionResult Create([Bind(Include = "SIMCardID,SIMBatchID,SerialNumber,MobileNumber,ActivatedOn,IsActive")] SimCards m)
 {
     if (ModelState.IsValid)
     {
         m.IsAvailable = true;
         db.SimCards.Add(m);
         db.SaveChanges();
         return(RedirectToAction("Index", "SimCards"));
     }
     ViewBag.SIMBatchID = new SelectList(db.SimCardBatches, "SimBatchID", "BatchReference", m.SIMBatchID);
     return(View(m));
 }
Ejemplo n.º 5
0
        // GET: AdminSimCards/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SimCards simCards = db.SimCards.Find(id);

            if (simCards == null)
            {
                return(HttpNotFound());
            }
            return(View(simCards));
        }
Ejemplo n.º 6
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SimCards m = db.SimCards.Find(id);

            if (m == null)
            {
                return(HttpNotFound());
            }
            return(View(m));
        }
Ejemplo n.º 7
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SimCards m = db.SimCards.Find(id);

            if (m == null)
            {
                return(HttpNotFound());
            }
            ViewBag.SIMBatchID = new SelectList(db.SimCardBatches, "SimBatchID", "BatchReference", m.SIMBatchID);
            return(View(m));
        }
Ejemplo n.º 8
0
        public ActionResult EnableService(int id)
        {
            Users    user = DbContext.Users.ToList().Where(u => u.IdCard.Equals(Session["userId"])).First();
            SimCards card = DbContext.SimCards.Where(c => c.CustomerId.Equals(user.IdCard)).First();

            DbContext.SimServices.Add(new SimServices()
            {
                ActivationDate = DateTime.Now, ServiceId = id, SimId = card.SimId, StatusCode = 1
            });
            DbContext.SaveChanges();
            Services service = DbContext.Services.ToList().Where(s => s.ServiceId == id).First();

            ViewBag.Message = "You've been successfully enabled " + service.ServiceName + " for $" + service.Price;
            ViewBag.Status  = "success";
            return(View("Services", DbContext.Services.ToList()));
        }
Ejemplo n.º 9
0
        public ActionResult Cabinet()
        {
            Users    user   = DbContext.Users.ToList().Where(u => u.IdCard.Equals(Session["userId"])).First();
            SimCards card   = DbContext.SimCards.Where(c => c.CustomerId.Equals(user.IdCard)).First();
            Tariffs  tariff = DbContext.Tariffs.ToList().Where(t => t.TariffId == card.TariffId).First();

            ViewBag.Tariff = tariff;
            IEnumerable <SimServices> activations = DbContext.SimServices.ToList().Where(ss => ss.SimId.Equals(card.SimId) && ss.StatusCode == 1);
            List <Services>           services    = new List <Services>();

            foreach (SimServices activation in activations)
            {
                services.Add(DbContext.Services.ToList().Where(s => s.ServiceId == activation.ServiceId).First());
            }
            return(View(services));
        }
Ejemplo n.º 10
0
        public ActionResult Order(int id)
        {
            if (Session["userId"] != null)
            {
                Users    user     = DbContext.Users.ToList().Where(u => u.IdCard.Equals(Session["userId"])).First();
                SimCards card     = DbContext.SimCards.Where(c => c.CustomerId.Equals(user.IdCard)).First();
                Orders   NewOrder = new Orders()
                {
                    ClientName = user.Name, ClientPhone = card.PhoneNumber, PackId = id
                };
                DbContext.Orders.Add(NewOrder);
                DbContext.SaveChanges();

                ViewBag.OrderMessage = "Thenk you for your order, " + user.Name + ", please wait for the callback on " + card.PhoneNumber;
                ViewBag.Packs        = DbContext.StarterPacks;
                return(View("Index"));
            }
            return(RedirectToAction("OrderPage", new { id }));
        }