public async Task <ActionResult> CreateSubCommunity(string subCommunityName, List <String> selectedStreetFloorIDArray, int CommunityId) { SubCommunitiesController subCommunitiesController = new SubCommunitiesController(); Response <SubCommunity> responseSubCommunity = new Response <SubCommunity>(); SubCommunity subCommunity = new SubCommunity(); subCommunity.communityID = CommunityId; subCommunity.name = subCommunityName; responseSubCommunity = await subCommunitiesController.PostSubCommunity(subCommunity); SubCommunitySelectedStreetFloorsController subCommunitySelectedStreetFloorsController = new SubCommunitySelectedStreetFloorsController(); if (responseSubCommunity.model != null) { foreach (var item in selectedStreetFloorIDArray) { SubCommunitySelectedStreetFloor subCommunitySelectedStreetFloor = new SubCommunitySelectedStreetFloor(); subCommunitySelectedStreetFloor.communityStreetFloorId = Convert.ToInt32(item); subCommunitySelectedStreetFloor.subCommunityId = responseSubCommunity.model.id; await subCommunitySelectedStreetFloorsController.PostSubCommunitySelectedStreetFloor(subCommunitySelectedStreetFloor); } } return(Json(new{ Status = "Success" })); }
public async Task <ActionResult> AddStreetFloor(int subCommunityId, int streetFloorId) { SubCommunitySelectedStreetFloorsController subCommunitySelectedStreetFloorsController = new SubCommunitySelectedStreetFloorsController(); SubCommunitySelectedStreetFloor subCommunitySelectedStreetFloor = new SubCommunitySelectedStreetFloor(); subCommunitySelectedStreetFloor.communityStreetFloorId = Convert.ToInt32(streetFloorId); subCommunitySelectedStreetFloor.subCommunityId = subCommunityId; await subCommunitySelectedStreetFloorsController.PostSubCommunitySelectedStreetFloor(subCommunitySelectedStreetFloor); return(Json(new { Status = "Success" })); }