public int UpdateCustomerCharges(CustomerCharges customerCharges) { CustomerCharges forUpdate = _customerChargesRepository.GetById(customerCharges.Id); _customerChargesRepository.Update(CustomerChargesTranslator.UpdateCustomerChargesTranslator(customerCharges, forUpdate)); _unitOfWork.Save(); return(customerCharges.Id); }
public ActionResult DeleteConfirmed(int id) { CustomerCharges customerCharges = db.CustomerCharges.Find(id); db.CustomerCharges.Remove(customerCharges); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: CustomerCharges/Create public ActionResult Create(string id) { var model = new CustomerCharges(); var user = db.Users.First(u => u.Id == id); model.ApplicationUserId = id; ViewBag.UserName = user.UserName; return(View(model)); }
public ActionResult Edit([Bind(Include = "Id,Date,Charge,ApplicationUserId")] CustomerCharges customerCharges) { if (ModelState.IsValid) { db.Entry(customerCharges).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ApplicationUserId = new SelectList(db.ApplicationUsers, "Id", "FirstName", customerCharges.ApplicationUserId); return(View(customerCharges)); }
public ActionResult Create([Bind(Include = "Date,Charge,ApplicationUserId")] CustomerCharges model) { if (ModelState.IsValid) { db.CustomerCharges.Add(model); db.SaveChanges(); return(RedirectToAction("Index", "Manage", new { Message = ManageMessageId.AddedChargeSuccess })); } return(View(model)); }
// GET: CustomerCharges/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerCharges customerCharges = db.CustomerCharges.Find(id); if (customerCharges == null) { return(HttpNotFound()); } return(View(customerCharges)); }
// GET: CustomerCharges/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerCharges customerCharges = db.CustomerCharges.Find(id); if (customerCharges == null) { return(HttpNotFound()); } ViewBag.ApplicationUserId = new SelectList(db.ApplicationUsers, "Id", "FirstName", customerCharges.ApplicationUserId); return(View(customerCharges)); }
public static CustomerCharges UpdateCustomerChargesTranslator(CustomerCharges update, CustomerCharges fromDB) { CustomerCharges forUpdate = new CustomerCharges(); forUpdate.Id = fromDB.Id; forUpdate.CustomerTransactionId = fromDB.CustomerTransactionId; forUpdate.ServiceTypeId = update.ServiceTypeId == 0 ? fromDB.ServiceTypeId : update.ServiceTypeId; forUpdate.ItemName = String.IsNullOrWhiteSpace(update.ItemName) ? fromDB.ItemName : update.ItemName; forUpdate.ItemDescription = String.IsNullOrWhiteSpace(update.ItemDescription) ? fromDB.ItemDescription : update.ItemDescription; forUpdate.Price = fromDB.Price; forUpdate.Amount = fromDB.Amount; forUpdate.Change = fromDB.Change; forUpdate.PromoCode = String.IsNullOrWhiteSpace(update.PromoCode) ? fromDB.PromoCode : update.PromoCode; forUpdate.Destination = String.IsNullOrWhiteSpace(update.Destination) ? fromDB.Destination : update.Destination; forUpdate.ComputedDistance = String.IsNullOrWhiteSpace(update.ComputedDistance) ? fromDB.ComputedDistance : update.ComputedDistance; forUpdate.PictureSelfieFilePath = String.IsNullOrWhiteSpace(update.PictureSelfieFilePath) ? fromDB.PictureSelfieFilePath : update.PictureSelfieFilePath; forUpdate.PictureSelfieFilePath = String.IsNullOrWhiteSpace(update.PictureSelfieFilePath) ? fromDB.PictureSelfieFilePath : update.PictureSelfieFilePath; return(forUpdate); }
public int InsertCustomerCharges(CustomerCharges customerCharges) { _customerChargesRepository.Insert(customerCharges); _unitOfWork.Save(); return(customerCharges.Id); }
public int UpdateCustomerCharges(CustomerCharges customerCharges) { return(_customerChargesWorkflow.UpdateCustomerCharges(customerCharges)); }
public int InsertCustomerCharges(CustomerCharges customerCharges) { return(_customerChargesWorkflow.InsertCustomerCharges(customerCharges)); }