Пример #1
0
 private void AddItem(Wit_Category category)
 {
     foreach (Wit_Item item in category.Wit_Item)
     {
         Items.Add(Wit_Item.ToSerializable(item));
     }
 }
Пример #2
0
        public async Task <ActionResult> Edit([Bind(Include = "Category_UID,Company_UID,CategoryName")] Wit_Category wit_Category)
        {
            if (ModelState.IsValid)
            {
                await ICategory.UpdateAsync(wit_Category, User.Identity.Name);

                return(RedirectToAction("Index"));
            }
            ViewBag.Company_UID = new SelectList(await ICompany.GetAllAsync(), "Company_UID", "CompanyName", wit_Category.Company_UID);
            return(View(wit_Category));
        }
Пример #3
0
        public void RemoveAsyncTest()
        {
            Wit_Category cat = new Wit_Category();

            try
            {
                cat.RemoveAsync(new Guid("47DF81BC-D64E-E411-A417-D459F8E9FF23")).Wait();
            }
            catch (Exception e) { }
            Assert.Fail();
        }
Пример #4
0
        // GET: Category/Details/5
        public async Task <ActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Wit_Category wit_Category = await ICategory.FindByIdAsync(id);

            if (wit_Category == null)
            {
                return(HttpNotFound());
            }
            return(View(wit_Category));
        }
Пример #5
0
        private void GetCategories(string companyUID)
        {
            using (WitServiceDBContext db = new WitServiceDBContext())
            {
                db.Configuration.LazyLoadingEnabled   = true;
                db.Configuration.ProxyCreationEnabled = true;
                var cat = db.Wit_Category.Where(m => m.Company_UID == new Guid(companyUID)).ToList();

                foreach (Wit_Category category in cat)
                {
                    Categories.Add(Wit_Category.ToSerializable(category));
                    AddItem(category);
                }
            }
        }
Пример #6
0
        // GET: Category/Edit/5
        public async Task <ActionResult> Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Wit_Category wit_Category = await ICategory.FindByIdAsync(id);

            if (wit_Category == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Company_UID = new SelectList(await ICompany.GetAllAsync(), "Company_UID", "CompanyName", wit_Category.Company_UID);
            return(View(wit_Category));
        }