Exemplo n.º 1
0
 // GET: Categories/Delete/5
 public ActionResult Delete(int id)
 {
     try
     {
         using (ContextBll ctx = new ContextBll())
         {
             ctx.DeleteCategories(id);
         }
     }
     catch (Exception ex)
     {
         ViewBag.Exception = ex;
         return(View("Error"));
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 2
0
 public ActionResult Create(ProductsCategoriesmolels collection)
 {
     try
     {
         using (ContextBll ctx = new ContextBll())
         {
             int catid = ctx.CreateCategories(collection.CategoryID, collection.Categorie);
             ctx.CreateProduct(collection.ProductsID, catid, collection.SellerID, collection.Name, collection.Descrption, collection.ReservePrice, collection.WinningofferID, collection.Comments, collection.Photos, collection.Categorie, "sellerName", "sellerName");
         }
         // TODO: Add insert logic
         return(RedirectToAction("Index", "Products"));
     }
     catch (Exception EX)
     {
         return(View());
     }
 }
Exemplo n.º 3
0
        public ActionResult Delete(int id, BusinessLogicLayer.CategorieBLL collection)
        {
            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    ctx.DeleteCategories(id);
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception Ex)
            {
                ViewBag.Exception = Ex;
                return(View("Error"));
            }
        }
Exemplo n.º 4
0
        List <SelectListItem> GetBuyersItems()
        {
            List <SelectListItem> ProposedReturnValue = new List <SelectListItem>();

            using (ContextBll ctx = new ContextBll())
            {
                List <UserBLL> users = ctx.GetUsers(0, 25);
                foreach (UserBLL r in users)
                {
                    SelectListItem i = new SelectListItem();

                    i.Value = r.UserID.ToString();
                    i.Text  = r.EmailAdderess;
                    ProposedReturnValue.Add(i);
                }
            }
            return(ProposedReturnValue);
        }
Exemplo n.º 5
0
        List <SelectListItem> GetProductsItems()
        {
            List <SelectListItem> ProposedReturnValue = new List <SelectListItem>();

            using (ContextBll ctx = new ContextBll())
            {
                List <OfferBLL> roles = ctx.GetOffer(0, 25);
                foreach (OfferBLL r in roles)
                {
                    SelectListItem i = new SelectListItem();

                    i.Value = r.ProductID.ToString();
                    i.Text  = r.ProductName;
                    ProposedReturnValue.Add(i);
                }
            }
            return(ProposedReturnValue);
        }
Exemplo n.º 6
0
        public ActionResult Edit(int id, BusinessLogicLayer.ProductBLL collection)
        {
            try
            {
                // TODO: Add insert logic here
                using (ContextBll ctx = new ContextBll())
                {
                    ctx.UpdateProduct(collection);
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception Ex)
            {
                ViewBag.Exception = Ex;
                return(View("Error"));
            }
        }
Exemplo n.º 7
0
        List <SelectListItem> GetSellerItems()
        {
            List <SelectListItem> ProposedReturnValue = new List <SelectListItem>();

            using (ContextBll ctx = new ContextBll())
            {
                List <UserBLL> roles = ctx.GetUsers(0, 25);
                foreach (UserBLL r in roles)
                {
                    SelectListItem i = new SelectListItem();

                    i.Value = r.UserID.ToString();
                    i.Text  = r.Name;
                    ProposedReturnValue.Add(i);
                }
            }
            return(ProposedReturnValue);
        }
Exemplo n.º 8
0
        public ActionResult Create(BusinessLogicLayer.CategorieBLL collection)
        {
            try
            {
                // TODO: Add insert logic here
                using (ContextBll ctx = new ContextBll())
                {
                    ctx.CreateCategories(collection);
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception Ex)
            {
                ViewBag.Exception = Ex;
                return(View("Error"));
            }
        }
Exemplo n.º 9
0
        public ActionResult Delete(int id, BusinessLogicLayer.UserBLL collection)
        {
            try
            {
                // TODO: Add insert logic here
                using (ContextBll ctx = new ContextBll())
                {
                    ctx.DeleteUser(id);
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception Ex)
            {
                ViewBag.Exception = Ex;
                return(View("Error"));
            }
        }
Exemplo n.º 10
0
        List <SelectListItem> GetRoleItems()
        {
            List <SelectListItem> ProposedReturnValue = new List <SelectListItem>();

            using (ContextBll ctx = new ContextBll())
            {
                List <RoleBLL> roles = ctx.GetRoles(0, 25);
                foreach (RoleBLL r in roles)
                {
                    SelectListItem i = new SelectListItem();

                    i.Value = r.RoleID.ToString();
                    i.Text  = r.Role;
                    ProposedReturnValue.Add(i);
                }
            }
            return(ProposedReturnValue);
        }
Exemplo n.º 11
0
        public ActionResult Page(int PageNumber, int PageSize)
        {
            ViewBag.PageNumber = PageNumber;
            ViewBag.PageSize   = PageSize;
            List <CategorieBLL> Model = new List <CategorieBLL>();

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    ViewBag.TotalCount = ctx.ObtainCategoriCount();
                    Model = ctx.GetCategorie(PageNumber * PageSize, PageSize);
                }
                return(View("Index", Model));
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
        }
Exemplo n.º 12
0
        // GET: Role/Edit/5
        public ActionResult Edit(int id)
        {
            RoleBLL Role;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    Role = ctx.FindRoleByID(id);
                    if (null == Role)
                    {
                        return(View("ItemNotFound")); // BKW make this view
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
            return(View(Role));
        }
Exemplo n.º 13
0
        public ActionResult Details(int id)
        {
            CategorieBLL categorie;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    categorie = ctx.FindCategorieByID(id);
                    if (null == categorie)
                    {
                        return(View("ItemNotFound"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
            return(View(categorie));
        }
Exemplo n.º 14
0
        // GET: Offer/Details/5
        public ActionResult Details(int id)
        {
            OfferBLL Offer;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    Offer = ctx.FindOfferByID(id);
                    if (null == Offer)
                    {
                        return(View("ItemNotFound"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
            return(View(Offer));
        }
Exemplo n.º 15
0
        // GET: Role/Details/5
        public ActionResult Details(int id)
        {
            UserBLL User;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    User = ctx.FindUserByID(id);
                    if (null == User)
                    {
                        return(View("ItemNotFound")); // BKW make this view
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
            return(View(User));
        }
Exemplo n.º 16
0
        // GET: Products/Details/5
        public ActionResult Details(int id)
        {
            ProductBLL product;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    product = ctx.FindProductByID(id);
                    if (null == product)
                    {
                        return(View("ItemNotFound"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
            return(View(product));
        }
Exemplo n.º 17
0
        // GET: Products/Edit/5
        public ActionResult Edit(int id)
        {
            ProductBLL Product;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    Product = ctx.FindProductByID(id);
                    if (null == Product)
                    {
                        return(View("ItemNotFound"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
            ViewBag.Product = GetCategorieItems();
            return(View(Product));
        }
Exemplo n.º 18
0
        public ActionResult Purchase(int id)
        {
            ProductBLL Product;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    Product = ctx.FindProductByID(id);
                    if (null == Product)
                    {
                        return(View("ItemNotFound"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }

            return(View(new PurchaseModel(Product)));
        }
Exemplo n.º 19
0
        // GET: Offer/Edit/5
        public ActionResult Edit(int id)
        {
            OfferBLL Offer;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    Offer = ctx.FindOfferByID(id);
                    if (null == Offer)
                    {
                        return(View("ItemNotFound"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
            ViewBag.Offer = GetProductsItems();
            ViewBag.Offer = GetBuyersItems();
            return(View(Offer));
        }