Exemplo n.º 1
0
        public ActionResult Delete(int ID)
        {
            BrandActionModel model = new BrandActionModel();

            var brand = services.GetBrandByID(ID);

            model.BrandID = brand.BrandID;

            return(PartialView("_Delete", model));
        }
Exemplo n.º 2
0
        public ActionResult AddAndEdit(int?ID)
        {
            BrandActionModel model = new BrandActionModel();

            if (ID.HasValue)
            {
                var brand = services.GetBrandByID(ID.Value);

                model.BrandID = brand.BrandID;

                model.BrandName = brand.BrandName;
            }

            return(PartialView("_AddAndEdit", model));
        }
Exemplo n.º 3
0
        public JsonResult Delete(BrandActionModel model)
        {
            JsonResult json = new JsonResult();

            var result = false;

            var brand = services.GetBrandByID(model.BrandID);

            result = services.DeleteBrand(brand);

            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to perform action on Main Menu" };
            }

            return(json);
        }
Exemplo n.º 4
0
        public JsonResult AddAndEdit(BrandActionModel model)
        {
            JsonResult json = new JsonResult();

            var result = false;

            if (model.BrandID > 0)
            {
                var brand = services.GetBrandByID(model.BrandID);

                brand.BrandName = model.BrandName;

                brand.UpdatedAt = DateTime.Now;

                result = services.UpdateBrand(brand);
            }
            else
            {
                Brand brand = new Brand();

                brand.BrandName = model.BrandName;

                brand.UpdatedAt = DateTime.Now;

                result = services.SaveBrand(brand);
            }

            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to perform action on Main Menu" };
            }

            return(json);
        }