Esempio n. 1
0
 public IActionResult DeleteConfirmed(int id)
 {
     Data.Models.Collection service = _context.Collections.Single(m => m.Id == id);
     _context.Collections.Remove(service);
     _context.SaveChanges();
     return(RedirectToAction("Index"));
 }
Esempio n. 2
0
 public IActionResult Edit(Data.Models.Collection service)
 {
     if (ModelState.IsValid)
     {
         _context.Update(service);
         _context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(service));
 }
Esempio n. 3
0
        // GET: Collection/Edit/5
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            Data.Models.Collection service = _context.Collections.Single(m => m.Id == id);
            if (service == null)
            {
                return(HttpNotFound());
            }
            return(View(service));
        }
Esempio n. 4
0
        public async Task <ActionResult> AddCollection(string collectionType, string amount, string colDate)
        {
            userId = int.Parse(User.Identity.GetUserId());

            Data.Models.Collection collection = new Data.Models.Collection();
            collection.UserId         = userId;
            collection.CollectionType = await collectionTypeService.GetAllByTypeID(int.Parse(collectionType));

            collection.CollectionDate = DateTime.Parse(colDate);
            collection.Amount         = Decimal.Parse(amount);

            collectionService.Create(collection);
            dbContext.SaveChanges();

            var model = await collectionService.GetAllByDateAsync(userId, collection.CollectionDate);

            return(PartialView("_Collections", model));;
        }
 public void Create(Data.Models.Collection collection)
 {
     collectionRepository.Create(collection);
 }