public async Task <ActionResult <costumer> > Postcostumer(costumer costumer) { _context.costumers.Add(costumer); await _context.SaveChangesAsync(); return(CreatedAtAction("Getcostumer", new { id = costumer.id }, costumer)); }
public async Task <IActionResult> Putcostumer(int id, costumer costumer) { if (id != costumer.id) { return(BadRequest()); } _context.Entry(costumer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!costumerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
static void ContohPenjualan() //deklarasi abstraction { abstrac abstrac1; abstrac1 = new costumer(); abstrac1.pembeli(); abstrac1.transaksi(); abstrac1.bayar(); Console.WriteLine("\nTekan enter untuk kembali ke menu"); Console.ReadKey(); }
public ActionResult Create(costumer costomer) { try { cos.Create(costomer); return(RedirectToAction("Index")); } catch (Exception exception) { return(View(exception.Message)); } }
public ActionResult Edit(int id, costumer costs) { try { costumer costomer = cos.GetById(id); costomer.name = costs.name; costomer.phoneNumber = costs.phoneNumber; cos.Update(costomer); return(RedirectToAction("Index")); } catch (Exception exception) { return(View(exception.Message)); } }
public void Delete(costumer costomer) { _costomerRepository.Delete(costomer); }
public void Update(costumer costomer) { _costomerRepository.Update(costomer); }
public void Create(costumer costomer) { _costomerRepository.Add(costomer); }