public void LocationsController_Create_Post_Invalid_Model_Should_Send_Back_For_Edit() { // Arrange var mock = new Mock <LocationsBackend>(context); var controller = new LocationsController(context, mock.Object); // Get mock data as view model var dataMock = new LocationsDataMock(); var dataRaw = dataMock.GetAllViewModelList()[0]; var data = new AllTablesViewModel(dataRaw); // Make ModelState Invalid controller.ModelState.AddModelError("test", "test"); // Act var result = controller.Create(data) as ViewResult; // Assert Assert.IsNotNull(result); Assert.AreEqual("Create Post", result.ViewName); }
public ActionResult AllTables() { var service = ServiceCreator.GetManagerService(User.Identity.Name); var activeTables = new List <Table>(); var inActiveTables = new List <Table>(); var restCookie = Request.Cookies.Get("CurRest"); if (restCookie != null) { var curRest = Guid.Parse(restCookie.Value); if (curRest != Guid.Empty) { activeTables = service.GetManagerTables(curRest).OrderByDescending(o => o.OrderPlaced).ToList(); inActiveTables = service.GetInActiveTables(curRest).OrderByDescending(o => o.OrderPlaced).Take(20).ToList(); } else { activeTables = service.GetManagerTables().OrderByDescending(o => o.OrderPlaced).ToList(); inActiveTables = service.GetInActiveTables().OrderByDescending(o => o.OrderPlaced).Take(20).ToList(); } } else { activeTables = service.GetManagerTables().OrderByDescending(o => o.OrderPlaced).ToList(); inActiveTables = service.GetInActiveTables().OrderByDescending(o => o.OrderPlaced).Take(20).ToList(); } var model = new AllTablesViewModel { ActiveTables = Mapper.Map <List <TableCardViewModel> >(activeTables), InActiveTables = Mapper.Map <List <TableCardViewModel> >(inActiveTables) }; return(View("TableCardList", model)); }
public void AllTablesViewModel_GetNewContact_Null_Parameter_Should_Pass() { // Arrange // Act var result = AllTablesViewModel.GetNewContact(null); // Assert Assert.IsNull(result); }
public void AllTablesViewModel_Default_Should_Pass() { // Arrange // Act var result = new AllTablesViewModel(); // Assert Assert.IsNotNull(result); }
public void AllTablesViewModel_GetNewSpecialQualities_Null_Parameter_Should_Pass() { // Arrange // Act var result = AllTablesViewModel.GetNewSpecialQualities(null); // Assert Assert.IsNull(result); }
/// <summary> /// /// Creates new Locations, Contacts, SpecialQualities, DailyHours. /// /// </summary> /// /// /// <param name="newLocation"> ViewModel with properties corresponding to the fields for each table </param> /// /// /// <returns> /// /// False: If newLocation is null or there was an error when attempting to insert /// True: It newLocation is successfully inserted into the Database /// /// </returns> public virtual bool Create(AllTablesViewModel newLocation) { if (newLocation == null) // Non-valid ViewModel Object { return(false); } // Ensures we don't end up with any duplicate LocationIds while (db.LocationIdNotUnique(newLocation.LocationId)) { newLocation.LocationId = Guid.NewGuid().ToString(); } Locations location = AllTablesViewModel.GetNewLocation(newLocation); Contacts contact = AllTablesViewModel.GetNewContact(newLocation); SpecialQualities specialQuality = AllTablesViewModel.GetNewSpecialQualities(newLocation); DailyHours dailyHours = AllTablesViewModel.GetNewDailyHours(newLocation); try { db.AlterRecordInfo(AlterRecordInfoEnum.Create, location); if (contact != null) { db.AlterRecordInfo(AlterRecordInfoEnum.Create, contact); } if (specialQuality != null) { db.AlterRecordInfo(AlterRecordInfoEnum.Create, specialQuality); } if (dailyHours != null) { db.AlterRecordInfo(AlterRecordInfoEnum.Create, dailyHours); } db.SaveChanges(); } catch (Exception) { return(false); } return(true); }
/// <summary> /// Converts Database State and LocationType strings to their corresponding Enum values so that we can use these values in the ViewModel. /// </summary> /// /// <param name="location"> A Locations Object </param> /// /// <returns> The Updated Location. </returns> private static Locations ConvertDbStringsToEnums(Locations location) { var state = AllTablesViewModel.ConvertStringToStateEnum(location.State); var locationType = AllTablesViewModel.ConvertStringToLocationTypeEnum(location.LocationType); location.State = state.GetType().GetMember(state.ToString()).First().GetCustomAttribute <DisplayAttribute>().Name; location.LocationType = locationType.GetType().GetMember(locationType.ToString()).First().GetCustomAttribute <DisplayAttribute>().Name; return(location); }
public void AllTablesViewModel_GetNewDailyHours_Null_Parameter_Should_Pass() { // Arrange var viewModel = new AllTablesViewModel(); // Act var result = AllTablesViewModel.GetNewDailyHours(null); // Assert Assert.IsNull(result); }
public void AllTablesViewModel_Constructor_With_Null_Context_Parameter_Should_Pass() { // Arrange // Act var result = new AllTablesViewModel(null); // Assert Assert.IsNotNull(result); Assert.IsNotNull(result.locations); }
public void AllTablesViewModel_ConvertBooleanEnumToString_Parameter_No_Should_Pass() { // Arrange var mockData = new LocationsDataMock(); var location = mockData.GetAllViewModelList()[0]; var viewModel = new AllTablesViewModel(); var viewModelProperties = typeof(AllTablesViewModel).GetProperties(); var specialQualitiesPropertyNameList = new List <string>(); foreach (var property in typeof(SpecialQualities).GetProperties()) { if (property.Name.Equals("LocationId") || property.Name.Equals("AccessNotes") || property.Name.Equals("InstallationType") || property.Name.Equals("Location") || property.Name.Equals("CoinStar") || property.Name.Equals("TellerServices") || property.Name.Equals("_24hourExpressBox") || property.Name.Equals("PartnerCreditUnion") || property.Name.Equals("MemberConsultant") || property.Name.Equals("InstantDebitCardReplacement")) { continue; } specialQualitiesPropertyNameList.Add(property.Name); } foreach (var property in viewModelProperties) { if (!specialQualitiesPropertyNameList.Contains(property.Name)) { continue; } property.SetValue(viewModel, BooleanEnum.N); } // Act var result = AllTablesViewModel.GetNewSpecialQualities(viewModel); // Assert foreach (var property in typeof(SpecialQualities).GetProperties()) { if (specialQualitiesPropertyNameList.Contains(property.Name)) { Assert.AreEqual("N", property.GetValue(result)); } } }
public void AllTablesViewModel_InstantiateViewModelropertiesWithOneLocation_Null_Parameter_Should_Pass() { // Arrange var viewModel = new AllTablesViewModel(); var mockData = new LocationsDataMock(); viewModel.locations = mockData.GetAllViewModelList(); // Act var result = viewModel.InstatiateViewModelPropertiesWithOneLocation(); // Assert Assert.IsTrue(result); }
public void AllTablesViewModel_ConvertStringToStateEnum_All_States_Should_Pass() { // Arrange var values = Enum.GetValues(typeof(StateEnum)); // Act // Assert foreach (var value in values) { Assert.AreEqual(value, AllTablesViewModel.ConvertStringToStateEnum(value.ToString())); } }
public void AllTablesViewModel_ConvertStringToBooleanEnum_Parameter_Yes_Should_Pass() { // Arrange var mockData = new LocationsDataMock(); var location = mockData.GetAllViewModelList()[0]; var viewModel = new AllTablesViewModel(); var properties = typeof(SpecialQualities).GetProperties(); // All properties of DailyHours is null by default var specialQualitiesPropertyNameList = new List <string>(); foreach (var property in properties) { if (property.Name.Equals("LocationId") || property.Name.Equals("AccessNotes") || property.Name.Equals("InstallationType") || property.Name.Equals("Location") || property.Name.Equals("CoinStar") || property.Name.Equals("TellerServices") || property.Name.Equals("_24hourExpressBox") || property.Name.Equals("PartnerCreditUnion") || property.Name.Equals("MemberConsultant") || property.Name.Equals("InstantDebitCardReplacement")) { continue; } property.SetValue(location.SpecialQualities, "Y"); specialQualitiesPropertyNameList.Add(property.Name); } // Act viewModel.InstatiateViewModelPropertiesWithOneLocation(location); // Assert properties = typeof(AllTablesViewModel).GetProperties(); foreach (var property in properties) { if (!specialQualitiesPropertyNameList.Contains(property.Name)) { continue; } Assert.AreEqual(BooleanEnum.Y, property.GetValue(viewModel)); } }
/// <summary> /// /// Updates the Location Record in the Database /// /// </summary> /// /// /// <param name="newLocation"> ViewModel Object containing the data for the fields of all the tables provided by the user </param> /// /// /// <returns> /// /// True: If successfully updates Location record in DB /// False: If newLocation is null, of if there was a Database Update error /// /// </returns> public virtual async Task <bool> EditPostAsync(AllTablesViewModel newLocation) { if (newLocation == null) { return(false); } // Get each table's Object Locations location = AllTablesViewModel.GetNewLocation(newLocation); location.Contact = AllTablesViewModel.GetNewContact(newLocation); location.SpecialQualities = AllTablesViewModel.GetNewSpecialQualities(newLocation); location.DailyHours = AllTablesViewModel.GetNewDailyHours(newLocation); bool result = false; // Value to be returned try { Locations response = await db.ReadOneRecordAsync(newLocation.LocationId).ConfigureAwait(true); if (response is null) // Location does not exist { return(false); } db._AddDeleteRow(response.Contact, location.Contact); db._AddDeleteRow(response.SpecialQualities, location.SpecialQualities); db._AddDeleteRow(response.DailyHours, location.DailyHours); response = location; result = db.AlterRecordInfo(AlterRecordInfoEnum.Update, response); return(result); } catch (Exception e) { errorMessage = e; return(false); } }
/// <summary> /// Gets the Location Object given a LocationId for the User to Edit upon /// </summary> /// /// <param name="id"> The string ID of the Locations Object the user wants to Edit </param> /// /// <returns> /// NULL: If Location record does not exist with the given ID /// Locations Object: If the record was found in the Database /// </returns> public virtual async Task <AllTablesViewModel> EditAsync(string id) { if (id == null) { return(null); } AllTablesViewModel locationViewModel = null; var location = await db.ReadOneRecordAsync(id).ConfigureAwait(false); // Get Location from Database if (location != null) { locationViewModel = new AllTablesViewModel(location); } return(locationViewModel); }
public void AllTablesViewModel_ConvertStringToBooleanEnum_Parameter_Null_Should_Pass() { // Arrange var mockData = new LocationsDataMock(); var location = mockData.GetAllViewModelList()[0]; var viewModel = new AllTablesViewModel(); var properties = typeof(SpecialQualities).GetProperties(); // All properties of DailyHours is null by default var specialQualitiesPropertyNameList = new List <string>(); foreach (var property in properties) { if (property.Name.Equals("LocationId") || property.Name.Equals("Location")) { continue; } property.SetValue(location.SpecialQualities, null); specialQualitiesPropertyNameList.Add(property.Name); } // Act viewModel.InstatiateViewModelPropertiesWithOneLocation(location); // Assert properties = typeof(AllTablesViewModel).GetProperties(); foreach (var property in properties) { if (specialQualitiesPropertyNameList.Contains(property.Name)) { if (property.Name.Equals("InstallationType") || property.Name.Equals("AccessNotes")) { continue; } Assert.AreEqual(BooleanEnum.NULL, property.GetValue(viewModel)); } } }
public void LocationsController_Create_Post_Valid_Model_Should_Pass() { // Arrange var mock = new Mock <LocationsBackend>(context); mock.Setup(backend => backend.Create(It.IsAny <AllTablesViewModel>())).Returns(true); var controller = new LocationsController(context, mock.Object); // Get mock data as view model var dataMock = new LocationsDataMock(); var dataRaw = dataMock.GetAllViewModelList()[0]; var data = new AllTablesViewModel(dataRaw); // Act var result = controller.Create(data) as RedirectToActionResult; // Assert Assert.IsNotNull(result); Assert.AreEqual("Index", result.ActionName); }
public void AllTablesViewModel_GetNewSpecialQualities_All_Properties_Are_Null_Parameter_Should_Pass() { // Arrange var viewModel = new AllTablesViewModel(); viewModel.AcceptCash = null; viewModel.AcceptDeposit = null; viewModel.Access = null; viewModel.AccessNotes = null; viewModel.Address = "362 Oxford Dr."; viewModel.Cashless = null; viewModel.City = "Starkville"; viewModel.CoopLocationId = "WA9820-174920573"; viewModel.Country = "US"; viewModel.County = "King County"; viewModel.DriveThruOnly = null; viewModel.EnvelopeRequired = null; viewModel.Fax = "8058451931"; viewModel.HandicapAccess = null; viewModel.Hours = "24 HOURS ACCESS"; viewModel.HoursDtfriClose = "9"; viewModel.HoursDtfriOpen = "9"; viewModel.HoursDtmonClose = "9"; viewModel.HoursDtmonOpen = "9"; viewModel.HoursDtsatClose = "9"; viewModel.HoursDtsatOpen = "9"; viewModel.HoursDtsunClose = "9"; viewModel.HoursDtsunOpen = "9"; viewModel.HoursDtthuClose = "9"; viewModel.HoursDtthuOpen = "9"; viewModel.HoursDttueClose = "9"; viewModel.HoursDttueOpen = "9"; viewModel.HoursDtwedClose = "9"; viewModel.HoursDtwedOpen = "9"; viewModel.HoursFriClose = "9"; viewModel.HoursFriOpen = "9"; viewModel.HoursMonClose = "9"; viewModel.HoursMonOpen = "9"; viewModel.HoursSatClose = "9"; viewModel.HoursSatOpen = "9"; viewModel.HoursSunClose = "9"; viewModel.HoursSunOpen = "9"; viewModel.HoursThuClose = "9"; viewModel.HoursThuOpen = "9"; viewModel.HoursTueClose = "9"; viewModel.HoursTueOpen = "9"; viewModel.HoursWedClose = "9"; viewModel.HoursWedOpen = "9"; viewModel.InstallationType = null; viewModel.Latitude = 13.3108M; viewModel.LimitedTransactions = null; viewModel.LocationId = "11170401-4112-43c1-aa4e-f73370e1014a"; viewModel.locations = new List <Locations>(); viewModel.LocationType = LocationTypeEnum.A; viewModel.Longitude = -132.8851M; viewModel.MilitaryIdRequired = null; viewModel.Name = "BECU"; viewModel.OnMilitaryBase = null; viewModel.OnPremise = null; viewModel.Phone = "4896771019"; viewModel.PostalCode = "39759"; viewModel.RestrictedAccess = null; viewModel.RetailOutlet = "Northgate"; viewModel.SelfServiceDevice = null; viewModel.SelfServiceOnly = null; viewModel.SoftDelete = BooleanEnum.Y; viewModel.State = StateEnum.MS; viewModel.Surcharge = null; viewModel.TakeCoopData = BooleanEnum.Y; viewModel.WebAddress = null; // Act var result = AllTablesViewModel.GetNewSpecialQualities(viewModel); // Assert Assert.IsNull(result); }
public void AllTablesViewModel_Get_Property_Defaults_Should_Pass() { // Arrange var result = new AllTablesViewModel(); // Act var s = result.SoftDelete; // Assert // Locations Assert.IsNull(result.Address); Assert.IsNull(result.City); Assert.IsNull(result.CoopLocationId); Assert.IsNull(result.Country); Assert.IsNull(result.County); Assert.IsNull(result.Hours); Assert.IsNotNull(result.Latitude); Assert.IsNull(result.LocationId); Assert.IsNotNull(result.LocationType); Assert.IsNotNull(result.Longitude); Assert.IsNull(result.Name); Assert.IsNull(result.PostalCode); Assert.IsNull(result.RetailOutlet); Assert.AreEqual(BooleanEnum.N, result.SoftDelete); Assert.IsNotNull(result.State); Assert.AreEqual(BooleanEnum.N, result.TakeCoopData); // Contacts Assert.IsNull(result.Phone); Assert.IsNull(result.Fax); Assert.IsNull(result.WebAddress); // Special Qualities Assert.IsNull(result.AcceptCash); Assert.IsNull(result.AcceptDeposit); Assert.IsNull(result.Access); Assert.IsNull(result.AccessNotes); Assert.IsNull(result.Cashless); Assert.IsNull(result.DriveThruOnly); Assert.IsNull(result.EnvelopeRequired); Assert.IsNull(result.HandicapAccess); Assert.IsNull(result.InstallationType); Assert.IsNull(result.LimitedTransactions); Assert.IsNotNull(result.locations); Assert.AreEqual(0, result.locations.Capacity); Assert.IsNull(result.MilitaryIdRequired); Assert.IsNull(result.OnMilitaryBase); Assert.IsNull(result.OnPremise); Assert.IsNull(result.RestrictedAccess); Assert.IsNull(result.SelfServiceDevice); Assert.IsNull(result.SelfServiceOnly); Assert.IsNotNull(result.State); Assert.IsNull(result.Surcharge); // Hours Per Day Of The Week Assert.IsNull(result.HoursDtfriClose); Assert.IsNull(result.HoursDtfriOpen); Assert.IsNull(result.HoursDtmonClose); Assert.IsNull(result.HoursDtmonOpen); Assert.IsNull(result.HoursDtsatClose); Assert.IsNull(result.HoursDtsatOpen); Assert.IsNull(result.HoursDtsunClose); Assert.IsNull(result.HoursDtsunOpen); Assert.IsNull(result.HoursDtthuClose); Assert.IsNull(result.HoursDtthuOpen); Assert.IsNull(result.HoursDttueClose); Assert.IsNull(result.HoursDttueOpen); Assert.IsNull(result.HoursDtwedClose); Assert.IsNull(result.HoursDtwedOpen); Assert.IsNull(result.HoursFriClose); Assert.IsNull(result.HoursFriOpen); Assert.IsNull(result.HoursMonClose); Assert.IsNull(result.HoursMonOpen); Assert.IsNull(result.HoursSatClose); Assert.IsNull(result.HoursSatOpen); Assert.IsNull(result.HoursSunClose); Assert.IsNull(result.HoursSunOpen); Assert.IsNull(result.HoursThuClose); Assert.IsNull(result.HoursThuOpen); Assert.IsNull(result.HoursTueClose); Assert.IsNull(result.HoursTueOpen); Assert.IsNull(result.HoursWedClose); Assert.IsNull(result.HoursWedOpen); }
public ActionResult UpdateTables() { var service = ServiceCreator.GetManagerService(User.Identity.Name); var rests = service.GetAllRestaurants(); var restCookie = Request.Cookies.Get("CurRest"); string restOptionsView = ""; string tablesView = ""; var restsModel = new RestOptionsViewModel { AvailableRests = new List <Restaurant> { new Restaurant { Name = "Все", Id = Guid.Empty } } }; if (rests != null && rests.Any()) { restsModel.AvailableRests.AddRange(rests); if (restCookie != null) { var curRest = restCookie.Value; var rest = service.GetRestaurant(Guid.Parse(curRest)); if (rest == null) { restCookie.Value = Guid.Empty.ToString(); Response.Cookies.Set(restCookie); restsModel.CurrentRest = Guid.Empty; } else { restsModel.CurrentRest = rest.Id; } } } restOptionsView = RenderPartialViewToString("RestaurantOptions", restsModel); var activeTables = new List <Table>(); var inActiveTables = new List <Table>(); if (restCookie != null) { var curRest = Guid.Parse(restCookie.Value); if (curRest != Guid.Empty) { activeTables = service.GetManagerTables(curRest).OrderByDescending(o => o.OrderPlaced).ToList(); inActiveTables = service.GetInActiveTables(curRest).OrderByDescending(o => o.OrderPlaced).Take(20).ToList(); } else { activeTables = service.GetManagerTables().OrderByDescending(o => o.OrderPlaced).ToList(); inActiveTables = service.GetInActiveTables().OrderByDescending(o => o.OrderPlaced).Take(20).ToList(); } } else { activeTables = service.GetManagerTables().OrderByDescending(o => o.OrderPlaced).ToList(); inActiveTables = service.GetInActiveTables().OrderByDescending(o => o.OrderPlaced).Take(20).ToList(); } var newTables = activeTables.Where(o => !o.OrderProcessed).Any(); var tablesModel = new AllTablesViewModel { ActiveTables = Mapper.Map <List <TableCardViewModel> >(activeTables), InActiveTables = Mapper.Map <List <TableCardViewModel> >(inActiveTables) }; tablesView = RenderPartialViewToString("TableCardList", tablesModel); return(Json(new { isAuthorized = true, isSuccess = true, tablesView = tablesView, restOptionsView = restOptionsView, newTables = newTables }, JsonRequestBehavior.AllowGet)); }
public void AllTablesViewModel_Set_Property_Should_Pass() { // Arrange var result = new AllTablesViewModel(); // Act // Locations result.AcceptCash = BooleanEnum.Y; result.AcceptDeposit = BooleanEnum.Y; result.Access = BooleanEnum.Y; result.AccessNotes = "Lobby"; result.Address = "362 Oxford Dr."; result.Cashless = BooleanEnum.Y; result.City = "Starkville"; result.CoopLocationId = "WA9820-174920573"; result.Country = "US"; result.County = "King County"; result.DriveThruOnly = BooleanEnum.Y; result.EnvelopeRequired = BooleanEnum.Y; result.Fax = "8058451931"; result.HandicapAccess = BooleanEnum.Y; result.Hours = "24 HOURS ACCESS"; result.HoursDtfriClose = "9"; result.HoursDtfriOpen = "9"; result.HoursDtmonClose = "9"; result.HoursDtmonOpen = "9"; result.HoursDtsatClose = "9"; result.HoursDtsatOpen = "9"; result.HoursDtsunClose = "9"; result.HoursDtsunOpen = "9"; result.HoursDtthuClose = "9"; result.HoursDtthuOpen = "9"; result.HoursDttueClose = "9"; result.HoursDttueOpen = "9"; result.HoursDtwedClose = "9"; result.HoursDtwedOpen = "9"; result.HoursFriClose = "9"; result.HoursFriOpen = "9"; result.HoursMonClose = "9"; result.HoursMonOpen = "9"; result.HoursSatClose = "9"; result.HoursSatOpen = "9"; result.HoursSunClose = "9"; result.HoursSunOpen = "9"; result.HoursThuClose = "9"; result.HoursThuOpen = "9"; result.HoursTueClose = "9"; result.HoursTueOpen = "9"; result.HoursWedClose = "9"; result.HoursWedOpen = "9"; result.InstallationType = "Walk-Up"; result.Latitude = 13.3108M; result.LimitedTransactions = BooleanEnum.Y; result.LocationId = "11170401-4112-43c1-aa4e-f73370e1014a"; result.locations = new List <Locations>(); result.LocationType = LocationTypeEnum.A; result.Longitude = -132.8851M; result.MilitaryIdRequired = BooleanEnum.Y; result.Name = "BECU"; result.OnMilitaryBase = BooleanEnum.Y; result.OnPremise = BooleanEnum.Y; result.Phone = "4896771019"; result.PostalCode = "39759"; result.RestrictedAccess = BooleanEnum.Y; result.RetailOutlet = "Northgate"; result.SelfServiceDevice = BooleanEnum.Y; result.SelfServiceOnly = BooleanEnum.Y; result.SoftDelete = BooleanEnum.Y; result.State = StateEnum.MS; result.Surcharge = BooleanEnum.Y; result.TakeCoopData = BooleanEnum.Y; result.WebAddress = "https://trypap.com/"; // Assert // Locations Assert.AreEqual(BooleanEnum.Y, result.AcceptCash); Assert.AreEqual(BooleanEnum.Y, result.AcceptDeposit); Assert.AreEqual(BooleanEnum.Y, result.Access); Assert.AreEqual("Lobby", result.AccessNotes); Assert.AreEqual("362 Oxford Dr.", result.Address); Assert.AreEqual(BooleanEnum.Y, result.Cashless); Assert.AreEqual("Starkville", result.City); Assert.AreEqual("WA9820-174920573", result.CoopLocationId); Assert.AreEqual("US", result.Country); Assert.AreEqual("King County", result.County); Assert.AreEqual(BooleanEnum.Y, result.DriveThruOnly); Assert.AreEqual(BooleanEnum.Y, result.EnvelopeRequired); Assert.AreEqual("8058451931", result.Fax); Assert.AreEqual(BooleanEnum.Y, result.HandicapAccess); Assert.AreEqual("24 HOURS ACCESS", result.Hours); Assert.AreEqual("9", result.HoursDtfriClose); Assert.AreEqual("9", result.HoursDtfriOpen); Assert.AreEqual("9", result.HoursDtmonClose); Assert.AreEqual("9", result.HoursDtmonOpen); Assert.AreEqual("9", result.HoursDtsatClose); Assert.AreEqual("9", result.HoursDtsatOpen); Assert.AreEqual("9", result.HoursDtsunClose); Assert.AreEqual("9", result.HoursDtsunOpen); Assert.AreEqual("9", result.HoursDtthuClose); Assert.AreEqual("9", result.HoursDtthuOpen); Assert.AreEqual("9", result.HoursDttueClose); Assert.AreEqual("9", result.HoursDttueOpen); Assert.AreEqual("9", result.HoursDtwedClose); Assert.AreEqual("9", result.HoursDtwedOpen); Assert.AreEqual("9", result.HoursFriClose); Assert.AreEqual("9", result.HoursFriOpen); Assert.AreEqual("9", result.HoursMonClose); Assert.AreEqual("9", result.HoursMonOpen); Assert.AreEqual("9", result.HoursSatClose); Assert.AreEqual("9", result.HoursSatOpen); Assert.AreEqual("9", result.HoursSunClose); Assert.AreEqual("9", result.HoursSunOpen); Assert.AreEqual("9", result.HoursThuClose); Assert.AreEqual("9", result.HoursThuOpen); Assert.AreEqual("9", result.HoursTueClose); Assert.AreEqual("9", result.HoursTueOpen); Assert.AreEqual("9", result.HoursWedClose); Assert.AreEqual("9", result.HoursWedOpen); Assert.AreEqual("Walk-Up", result.InstallationType); Assert.AreEqual(13.3108M, result.Latitude); Assert.AreEqual(BooleanEnum.Y, result.LimitedTransactions); Assert.AreEqual("11170401-4112-43c1-aa4e-f73370e1014a", result.LocationId); Assert.IsNotNull(result.locations); Assert.AreEqual(0, result.locations.Capacity); Assert.AreEqual(LocationTypeEnum.A, result.LocationType); Assert.AreEqual(-132.8851M, result.Longitude); Assert.AreEqual(BooleanEnum.Y, result.MilitaryIdRequired); Assert.AreEqual("BECU", result.Name); Assert.AreEqual(BooleanEnum.Y, result.OnMilitaryBase); Assert.AreEqual(BooleanEnum.Y, result.OnPremise); Assert.AreEqual("4896771019", result.Phone); Assert.AreEqual("39759", result.PostalCode); Assert.AreEqual(BooleanEnum.Y, result.RestrictedAccess); Assert.AreEqual("Northgate", result.RetailOutlet); Assert.AreEqual(BooleanEnum.Y, result.SelfServiceDevice); Assert.AreEqual(BooleanEnum.Y, result.SelfServiceOnly); Assert.AreEqual(BooleanEnum.Y, result.SoftDelete); Assert.AreEqual(StateEnum.MS, result.State); Assert.AreEqual(BooleanEnum.Y, result.Surcharge); Assert.AreEqual(BooleanEnum.Y, result.TakeCoopData); Assert.AreEqual("https://trypap.com/", result.WebAddress); }
public async Task <IActionResult> Edit(string id, [Bind("LocationId," + "CoopLocationId," + "TakeCoopData," + "SoftDelete," + "Name," + "Address," + "City," + "County," + "State," + "PostalCode," + "Country," + "Latitude," + "Longitude," + "Hours," + "RetailOutlet," + "LocationType," + "Phone," + "Fax," + "WebAddress," + "RestrictedAccess," + "AcceptDeposit," + "AcceptCash," + "EnvelopeRequired," + "OnMilitaryBase," + "OnPremise," + "Surcharge," + "Access," + "AccessNotes," + "InstallationType," + "HandicapAccess," + "Cashless," + "DriveThruOnly," + "LimitedTransactions," + "MilitaryIdRequired," + "SelfServiceDevice," + "SelfServiceOnly," + "HoursMonOpen," + "HoursMonClose," + "HoursTueOpen," + "HoursTueClose," + "HoursWedOpen," + "HoursWedClose," + "HoursThuOpen," + "HoursThuClose," + "HoursFriOpen," + "HoursFriClose," + "HoursSatOpen," + "HoursSatClose," + "HoursSunOpen," + "HoursSunClose," + "HoursDtmonOpen," + "HoursDtmonClose," + "HoursDttueOpen," + "HoursDttueClose," + "HoursDtwedOpen," + "HoursDtwedClose," + "HoursDtthuOpen," + "HoursDtthuClose," + "HoursDtfriOpen," + "HoursDtfriClose," + "HoursDtsatOpen," + "HoursDtsatClose," + "HoursDtsunOpen," + "HoursDtsunClose")] AllTablesViewModel location) { if (location == null) // Edit submit error { return(View(location)); } if (id != location.LocationId) // IDs don't match { return(NotFound()); } if (!ModelState.IsValid) // Invalid model state { return(View(location)); } var result = await backend.EditPostAsync(location).ConfigureAwait(false); if (!result) // DB update error, retry { return(View(location)); } return(RedirectToAction(nameof(Index))); }
public ActionResult Create([Bind("LocationId," + "CoopLocationId," + "TakeCoopData," + "SoftDelete," + "Name," + "Address," + "City," + "County," + "State," + "PostalCode," + "Country," + "Latitude," + "Longitude," + "Hours," + "RetailOutlet," + "LocationType," + "Phone," + "Fax," + "WebAddress," + "RestrictedAccess," + "AcceptDeposit," + "AcceptCash," + "EnvelopeRequired," + "OnMilitaryBase," + "OnPremise," + "Surcharge," + "Access," + "AccessNotes," + "InstallationType," + "HandicapAccess," + "Cashless," + "DriveThruOnly," + "LimitedTransactions," + "MilitaryIdRequired," + "SelfServiceDevice," + "SelfServiceOnly," + "HoursMonOpen," + "HoursMonClose," + "HoursTueOpen," + "HoursTueClose," + "HoursWedOpen," + "HoursWedClose," + "HoursThuOpen," + "HoursThuClose," + "HoursFriOpen," + "HoursFriClose," + "HoursSatOpen," + "HoursSatClose," + "HoursSunOpen," + "HoursSunClose," + "HoursDtmonOpen," + "HoursDtmonClose," + "HoursDttueOpen," + "HoursDttueClose," + "HoursDtwedOpen," + "HoursDtwedClose," + "HoursDtthuOpen," + "HoursDtthuClose," + "HoursDtfriOpen," + "HoursDtfriClose," + "HoursDtsatOpen," + "HoursDtsatClose," + "HoursDtsunOpen," + "HoursDtsunClose")] AllTablesViewModel newLocation) { if (!ModelState.IsValid) { var view = View(newLocation); view.ViewName = "Create Post"; return(view); } var result = backend.Create(newLocation); return(RedirectToAction(nameof(Index))); }