Exemplo n.º 1
0
        public async Task <IActionResult> EditAsync(int id, Matoleo matoleo)
        {
            if (id != matoleo.MatoleoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(matoleo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MatoleoExists(matoleo.MatoleoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ChurchMembersId"] = new SelectList(_context.ChurchMembers, "ChurchMembersId", "ChurchMembersId", matoleo.ChurchMembersId);
            ViewData["MatoleoId"]       = new SelectList(_context.Matoleo, "MatoleoId", "MatoleoId", matoleo.MatoleoId);
            return(View(matoleo));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteConfirmedAsync(Matoleo mato)
        {
            var matoleo = await _context.Matoleo.SingleOrDefaultAsync(m => m.MatoleoId == mato.MatoleoId);

            _context.Matoleo.Remove(matoleo);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 3
0
        // GET: Matoleos/Create
        public IActionResult Create()
        {
            Matoleo matoleo = new Matoleo();

            //ViewData["Savetime"] = SessionKeyDate;


            return(View(matoleo));
        }
        public IViewComponentResult Invoke()
        {
            var listed = _context.Matoleo.GroupBy(x => x.Savetime).Select(x => x.FirstOrDefault()).ToList();

            ViewBag.Timed = new SelectList(listed.Select(n => n.Savetime));
            Matoleo matoleo = new Matoleo();


            return(View(matoleo));
        }
Exemplo n.º 5
0
        public IActionResult Index(Matoleo matoleo)
        {
            var listed = _context.Matoleo.Include(m => m.ChurchMembers).Include(n => n.mengineyo).Where(n => n.Savetime == matoleo.Savetime).ToList();

            ViewBag.sum1      = listed.Sum(n => n.sadakaBk);
            ViewBag.sum2      = listed.Sum(n => n.sadakaConf);
            ViewBag.sum3      = listed.Sum(n => n.Zaka);
            ViewBag.sum4      = listed.Sum(n => n.Total);
            ViewBag.sum5      = listed.Sum(n => n.MpangoKanisa);
            ViewBag.sum6      = listed.Sum(n => n.sadakaMakambi);
            ViewBag.sum7      = listed.Sum(n => n.sadakaMajengo);
            ViewBag.mengineyo = listed.Select(n => n.mengineyo).ToList();
            return(View(listed));
        }
Exemplo n.º 6
0
 public async Task NudiaAsync(Matoleo matoleo, IList <Mengineyo> mengineyo)
 {
     foreach (var m in mengineyo)
     {
         Mengineyo mengi = new Mengineyo()
         {
             descr  = m.descr,
             Amount = m.Amount
         };
         mengi.MatoleoId = matoleo.MatoleoId;
         _context.Add(mengi);
         await _context.SaveChangesAsync();
     }
 }
Exemplo n.º 7
0
        // GET: Matoleos
        public IActionResult Index()

        {
            Matoleo matoleo = new Matoleo();

            var listed = _context.Matoleo.Include(m => m.ChurchMembers).Include(m => m.mengineyo).GroupBy(x => x.Savetime).First().ToList();


            ViewBag.Mengineyo = listed.Select(n => n.mengineyo).ToList();
            ViewBag.sum1      = listed.Sum(n => n.sadakaBk);
            ViewBag.sum2      = listed.Sum(n => n.sadakaConf);
            ViewBag.sum3      = listed.Sum(n => n.Zaka);
            ViewBag.sum4      = listed.Sum(n => n.Total);
            ViewBag.sum5      = listed.Sum(n => n.MpangoKanisa);
            ViewBag.sum6      = listed.Sum(n => n.sadakaMakambi);
            ViewBag.sum7      = listed.Sum(n => n.sadakaMajengo);

            return(View(listed));
        }
Exemplo n.º 8
0
        public IActionResult SummaryAsync(Matoleo matoleo, int Page = 1)
        {
            var listed = _context.Matoleo.AsNoTracking().Where(n => n.Savetime == matoleo.Savetime).Include(b => b.ChurchMembers);


            //.Skip((productPage - 1) * PageSize)
            //.Take(PageSize);
            var vai = ReflectionIT.Mvc.Paging.PaginList <Matoleo> .CreateAsync(listed, PageSize, Page, matoleo.Savetime.ToString(), matoleo.Savetime.ToString());

            vai.RouteValue = new Microsoft.AspNetCore.Routing.RouteValueDictionary
            {
                { matoleo.Savetime.ToString(), matoleo.Savetime }
            };
            ViewBag.sum1 = vai.Sum(n => n.sadakaBk);
            ViewBag.sum2 = vai.Sum(n => n.sadakaConf);
            ViewBag.sum3 = vai.Sum(n => n.Zaka);
            ViewBag.sum4 = vai.Sum(n => n.Total);
            ViewBag.sum5 = vai.Sum(n => n.MpangoKanisa);
            ViewBag.sum6 = vai.Sum(n => n.sadakaMakambi);
            ViewBag.sum7 = vai.Sum(n => n.sadakaMajengo);
            return(View(vai));
        }
Exemplo n.º 9
0
        public async Task <IActionResult> CreateAsync(Matoleo matoleo, IList <Mengineyo> mengineyo)
        {
            //HttpContext.Session.Set<DateTime>(SessionKeyDate, matoleo.Savetime);

            //var meng = formCollectiom.Contains("Name")
            if (ModelState.IsValid)
            {
                var exists = _context.Matoleo.Include(v => v.ChurchMembers).AsNoTracking().Any(x => x.ChurchMembers.Name == matoleo.ChurchMembers.Name);
                if (exists)
                {
                    _context.Update(matoleo);
                }

                _context.Add(matoleo);
                await _context.SaveChangesAsync();
                await NudiaAsync(matoleo, mengineyo);

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ChurchMembersId"] = new SelectList(_context.ChurchMembers, "ChurchMembersId", "ChurchMembersId", matoleo.ChurchMembersId);
            return(View(matoleo));
        }
Exemplo n.º 10
0
 internal static object CreateAsync(List <Matoleo> listed, int pageSize, int page, Matoleo matoleo, string sortExpression, string v)
 {
     throw new NotImplementedException();
 }