public void EditPembelian(PembelianCreateEditViewModel model)
        {
            var pembelian = GetPembelian(model.ID);

            pembelian.TanggalPembelian = model.Tanggal;

            context.SaveChanges();
        }
        public PembelianCreateEditViewModel GetPembelianCreateViewModel()
        {
            var viewModel = new PembelianCreateEditViewModel();

            viewModel.Tanggal = DateTime.Today;

            return(viewModel);
        }
        public PembelianCreateEditViewModel GetPembelianEditViewModel(int id)
        {
            var pembelian = GetPembelian(id);
            var viewModel = new PembelianCreateEditViewModel()
            {
                ID      = pembelian.ID,
                Tanggal = pembelian.TanggalPembelian
            };

            return(viewModel);
        }
        public void AddPembelian(PembelianCreateEditViewModel model)
        {
            var pembelian = new Pembelian()
            {
                ID = model.ID,
                TanggalPembelian = model.Tanggal
            };

            context.Add(pembelian);
            context.SaveChanges();
        }
Example #5
0
        public ActionResult Edit(PembelianCreateEditViewModel model)
        {
            try
            {
                pembelianProvider.EditPembelian(model);

                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                return(RedirectToAction("Edit"));
            }
        }
Example #6
0
 public ActionResult Create(PembelianCreateEditViewModel model)
 {
     try
     {
         pembelianProvider.AddPembelian(model);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         throw ex;
         return(RedirectToAction("Create"));
     }
 }