Example #1
0
 void MnuEditLocation_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor = Cursors.WaitCursor;
         MapLocation  loc      = dgIndividuals.SelectedRows[0].DataBoundItem as MapLocation;
         EditLocation editform = new EditLocation(loc.Location);
         Cursor = Cursors.Default;
         DialogResult result = editform.ShowDialog(this);
         editform.Dispose(); // needs disposed as it is only hidden because it is a modal dialog
         if (mapForm != null && mapForm.Visible)
         {
             if (mapForm is TimeLine)
             {
                 ((TimeLine)mapForm).RefreshClusters();
             }
             else if (mapForm is Places)
             {
                 ((Places)mapForm).RefreshClusters();
             }
         }
         UpdateIcons(loc.Location);
     }
     catch (Exception) { }
 }
Example #2
0
        public IActionResult EditLocationModal(EditLocation model)
        {
            if (ModelState.IsValid)
            {
                LocationDto dto = new LocationDto()
                {
                    Address      = model.Address,
                    City         = model.City,
                    Country      = model.Country,
                    Description  = model.Description,
                    LocationId   = model.LocationId,
                    LocationName = model.LocationName,
                    StateRegion  = model.StateRegion,
                    ZipCode      = model.ZipCode
                };

                if (model.IsAddNew)
                {
                    model.Result = LocationService.AddLocation(dto);
                }
                else
                {
                    model.Result = LocationService.UpdateLocation(dto);
                }
            }

            return(PartialView("_EditLocationPartial", model));
        }
        public async Task EditLocation(EditLocation model)
        {
            var location = new Data_Access_Layer.Location()
            {
                Id   = model.Id,
                Name = model.Name
            };

            LocationRepository.Update(location);
        }
Example #4
0
        private void EditLocation(FactLocation loc)
        {
            EditLocation editform = new EditLocation(loc);

            this.Cursor = Cursors.Default;
            DialogResult result = editform.ShowDialog(this);

            editform.Dispose(); // needs disposed as it is only hidden because it is a modal dialog
            // force refresh of locations from new edited data
            dgIndividuals.Refresh();
        }
Example #5
0
        public IActionResult OtherMagicCardDetails([FromRoute] int id = 1)
        {
            TempData["id"] = id;
            Lib.MagicCard card = _repo.GetMagicCard(id);
            EditLocation  l    = new EditLocation()
            {
                Card = card
            };

            return(View(l));
        }
Example #6
0
        public IActionResult EditLocationModal(string id)
        {
            EditLocation model = new EditLocation();

            Guid?locationId = Helper.ConvertToGuid(id);

            if (locationId.HasValue)
            {
                model = new EditLocation(LocationService.GetLocation(locationId.Value));
            }

            return(PartialView("_EditLocationPartial", model));
        }
        public async Task <HttpResult <bool> > UpdateLocation(Location location, CancellationToken token = default(CancellationToken))
        {
            var result = new HttpResult <bool>();

            var model = new EditLocation
            {
                Id   = location.Id,
                Name = location.Name
            };

            await _unitOfWork.EditLocation(model);

            return(result);
        }
Example #8
0
 public IActionResult PutMagicCard(EditLocation c, IFormCollection form)
 {
     try
     {
         int id = Convert.ToInt32(TempData["id"].ToString());
         TempData["id"]  = id;
         c.Card          = _repo.GetMagicCard(id);
         c.Card.Location = c.NewLocation;
         _repo.PutMagicCard(c.Card);
         EditLocation l = new EditLocation()
         {
             Card = c.Card
         };
         return(View("MagicCardDetails", l));
     }
     catch (Exception e)
     {
         return(BadRequest());
     }
 }
Example #9
0
        public ActionResult <EditLocation> EditLocation(EditLocation model)
        {
            try
            {
                IMapper mapper         = EDeliveryProfile.EditLocation();
                var     editedLocation = mapper.Map <Location>(model);

                var userIdClaim = User.FindFirst("MemberId")?.Value;
                var memberId    = int.TryParse(userIdClaim, out var id) ? id : 0;

                EDeliveryDBContext dBContext = new EDeliveryDBContext();

                var memberType = dBContext.Member.First(o => o.MemberId == memberId).MemberType;


                if (memberType.Equals(8))
                {
                    var customerId = dBContext.Customer.First(o => o.MemberId == memberId).CustomerId;
                    editedLocation.CustomerId = customerId;
                }
                else if (memberType.Equals(9))
                {
                    var restaurantId = dBContext.Restaurant.First(o => o.MemberId == memberId).RestaurantId;
                    editedLocation.RestaurantId = restaurantId;
                }
                else
                {
                    return(BadRequest());
                }

                _repository.EditLocation(editedLocation);
                return(new ObjectResult(new { message = "success", statusCode = HttpStatusCode.OK, response = "Succesfuly edited location" }));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to edit the location{ex}");
            }
            return(BadRequest("Failed to edit the location"));
        }
        public async Task <IActionResult> EditLocation([FromBody] EditLocation model)
        {
            await _unitOfWork.EditLocation(model);

            return(Ok());
        }