Example #1
0
        public async Task <IActionResult> Add(POIViewModel poiVM)
        {
            try
            {
                var poi = POI.GetPOI(poiVM);
                poi.Activated    = false;
                poi.CreationDate = DateTime.Now;
                AddDefinedTag(poiVM.Segments, poi);
                AddDefinedTag(poiVM.Tecnologies, poi);
                await CreateImageAsync(poi);

                _context.POIs.Add(poi);
                await _context.SaveChangesAsync();

                return(Json(new { status = "OK" }));
            }
            catch (Exception e) {
                return(Json(new { status = "BAD", message = e.Message }));
            }
        }