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")); }
public IActionResult Edit(Data.Models.Collection service) { if (ModelState.IsValid) { _context.Update(service); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(service)); }
// 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)); }
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); }