public ActionResult _AddRentedUnits() { var vm = new RentedUnitVM { RentedDate = DateTime.Today, CanChangeRentedDate = false }; return(PartialView("_EditRentedUnit", vm)); }
//public ActionResult _AddRentalAccountItems(int id) //{ // var vm = new RentedUnitVM {CustomerAccountId = id, RentedDate = DateTime.Today}; // return PartialView("_EditRentedUnit", vm); //} //[HttpPost] //public ActionResult _AddRentalAccountItems(RentedUnitVM mRentedUnitVm) //{ // if (TryValidateModel(mRentedUnitVm)) // { // var ru = new RentedUnit(); // if (TryUpdateModel(ru)) // { // if (ExecuteRepositoryAction(() => // { // _accountService.AddRentedUnit(ru.CustomerAccountId,ru); // _customerService.CommitChanges(); // })) // return ReturnJsonFormSuccess(); // } // } // return PartialView("_EditRentedUnit", mRentedUnitVm); //} public ActionResult _EditRentedItem(int id) { RentedUnitVM ru = Mapper.Map <RentedUnit, RentedUnitVM>(GetRentedUnit(id)); ru.CanChangeRentedDate = false; ru.CanChangeDeposit = false; ru.OldStockId = -1; //to avoid validation where same stock is selected in other screens return(PartialView("_EditRentedUnit", ru)); }
public ActionResult _EditRentedUnit(RentedUnitVM mRentedUnitVm) { var ru = TempAccountAsAddRentAccountVM().RentedUnits.Single(c => c.UnitId == mRentedUnitVm.UnitId); if (TryUpdateModel(ru)) { return(ReturnJsonFormSuccess()); } return(PartialView("../Account/_EditRentedUnit", mRentedUnitVm)); }
public ActionResult _EditRentedUnit(RentedUnitVM mRentedUnitVm) { var basket = GetRentalBasket(); var ru = basket.RentedUnits.Single(c => c.UnitId == mRentedUnitVm.UnitId); if (TryUpdateModel(ru)) { UpdateBasket(basket); return(ReturnJsonFormSuccess()); } return(PartialView("../Account/_EditRentedUnit", mRentedUnitVm)); }
public ActionResult _AddRentedUnits(RentedUnitVM mRentedUnitVm) { if (TryValidateModel(mRentedUnitVm)) { var ru = new RentedUnit(); if (TryUpdateModel(ru)) { ru.Stock = _stockService.GetStock(ru.StockId); ru.UnitId = TempAccountAsAddRentAccountVM().RentedUnits.NextIndex(c => c.UnitId); TempAccountAsAddRentAccountVM().RentedUnits.Add(ru); return(ReturnJsonFormSuccess()); } } return(PartialView("_EditRentedUnit", mRentedUnitVm)); }
public ActionResult _EditRentedItem(RentedUnitVM mRentedUnitVm) { var ru = GetRentedUnit(mRentedUnitVm.UnitId); if (TryUpdateModel(ru)) { if (ExecuteRepositoryAction(() => { _accountService.UpdateUnit(ru); _customerService.CommitChanges(); })) { return(ReturnJsonFormSuccess()); } } return(PartialView("_EditRentedUnit", mRentedUnitVm)); }