public KioskViewModel InsertKiosk(KioskBindingModel model, int companyId) { var kiosk = model.ToEntity(); kiosk = _kioskRepository.Add(kiosk); CurrentUnitOfWork.Commit(); foreach (var type1SlotName in model.Type1Slots) { var slot = model.ToSlotEntity(kiosk.Id, SystemDataListEnums.TierType.Tier1, type1SlotName); _slotRepository.Add(slot); CurrentUnitOfWork.Commit(); } foreach (var type2SlotName in model.Type2Slots) { var slot = model.ToSlotEntity(kiosk.Id, SystemDataListEnums.TierType.Tier2, type2SlotName); _slotRepository.Add(slot); CurrentUnitOfWork.Commit(); } kiosk = _kioskRepository.FindOne(kiosk.Id); var viewModel = kiosk.ToViewModel(); return(viewModel); }
public LocationViewModel InsertLocation(LocationBindingModel model) { var location = model.ToEntity(); location = _locationRepository.Add(location); CurrentUnitOfWork.Commit(); location = _locationRepository.FindOne(location.Id); var viewModel = location.ToViewModel(); return(viewModel); }