//Draw buttons for location app public override void AndroidDraw(SpriteBatch spritebatch, GraphicsDevice graphDevice) { Save.Draw(spritebatch, Offset); Delete.Draw(spritebatch, Offset); TextDrawing.Drawtext(new Point(0, 650) + Offset, LocationApplication.ReadCurrentLocationFromFile(), spritebatch); //TextDrawing.Drawtext(new Point(400, 800) + Offset, ErrorShow, spritebatch); }
public LocationController() { string connectionString = ConfigurationManager.ConnectionStrings["conexao"].ToString(); locationRepository = new LocationRepository(connectionString); locationApplication = new LocationApplication(locationRepository); }
public void Create(LocationApplication application) { var userWithEmail = _context.Users.FirstOrDefault(x => x.Email == application.Email); if (userWithEmail != null) { throw new AppException("There is already a user registered with this E-Mail address"); } if (!StringExtenstions.IsValid(application.Line1)) { throw new AppException("Address Line 1 cannot be empty."); } if (!StringExtenstions.IsValid(application.ZipCode)) { throw new AppException("Zip code cannot be empty."); } if (!StringExtenstions.IsValid(application.Line2)) { throw new AppException("Address Line 2 cannot be empty."); } if (!StringExtenstions.IsValid(application.Name)) { throw new AppException("The location must have a name."); } _context.LocationApplications.Add(application); _context.SaveChanges(); }
//Button 5 scene public Button5Scene(GraphicsDevice graphDevice, string ID) : base(graphDevice, ID) { Save = new DynamicButtonHorizontal(200, 200, 0.25, 0.75, Color.Red, graphDevice); Delete = new DynamicButtonHorizontal(400, 200, 0.25, 0.75, Color.Red, graphDevice); Save.SetText("Save Location"); Delete.SetText("Delete Location"); Save.SetDelegate(new Action(() => LocationApplication.SaveCurrentLocationToFile())); Delete.SetDelegate(new Action(() => LocationApplication.DeleteLocationFile())); }
public IActionResult AddLocation([FromBody] LocationApplicationDto applicationDto) { var application = new LocationApplication(); application = _mapper.Map(applicationDto, application); try { _locationsService.Create(application); return(Ok()); } catch (AppException ex) { return(BadRequest(new { message = ex.Message })); } }