public void DeletePlace(int id, string userName) { Place place = repo.GetPlace(id, userName); if (place != null) { repo.DeletePlace(id, userName); } }
public ActionResult DeleteConfirmed(int id) { var place = placeRepository.GetPlaceById(id); if (place.Image != null) { System.IO.File.Delete(Server.MapPath("/PlaceImages/" + place.Image)); } placeRepository.DeletePlace(id); placeRepository.Save(); return(RedirectToAction("Index")); }
public IActionResult Delete(Guid id) { var place = _context.GetPlaceById(id); if (place == null) { return(NotFound()); } _context.DeletePlace(id); _context.SaveChanges(); return(new NoContentResult()); }
public async Task <bool> DeletePlace(int placeId) { return(await _placeRepository.DeletePlace(placeId)); }
public ActionResult Create(PlaceModel place) { Logger.Debug("Inside Place Controller- Create Http Post"); try { if (Session["OrganizationGUID"] != null) { if (ModelState.IsValid) { Place _place = _IPlaceRepository.GetPlaceByID(place.PlaceID, new Guid(Session["OrganizationGUID"].ToString())); if (_place == null) { Place Place = new Place(); Place.PlaceGUID = Guid.NewGuid(); Place.UserGUID = new Guid(Session["UserGUID"].ToString()); Place.OrganizationGUID = new Guid(Session["OrganizationGUID"].ToString()); Place.PlaceID = place.PlaceID; Place.PlaceName = place.PlaceName; Place.FirstName = place.FirstName; Place.LastName = place.LastName; Place.MobilePhone = place.MobilePhone; Place.PlacePhone = place.PlacePhone; Place.HomePhone = place.HomePhone; Place.Emails = place.Emails; Place.AddressLine1 = place.AddressLine1; Place.AddressLine2 = place.AddressLine2; Place.City = place.City; Place.State = place.State; Place.Country = place.Country; Place.ZipCode = place.ZipCode; Place.CategoryID = 0; Place.IsDeleted = false; Place.CreateDate = DateTime.UtcNow; Place.UpdatedDate = DateTime.UtcNow; LatLong latLong = new LatLong(); latLong = GetLatLngCode(Place.AddressLine1, Place.AddressLine2, Place.City, Place.State, Place.Country, Place.ZipCode); Place.TimeZone = getTimeZone(latLong.Latitude, latLong.Longitude).ToString(); Person People = new Person(); People.PeopleGUID = Guid.NewGuid(); People.UserGUID = Place.UserGUID; People.OrganizationGUID = Place.OrganizationGUID; People.IsPrimaryContact = true; People.PlaceGUID = Place.PlaceGUID; People.FirstName = place.FirstName; People.LastName = place.LastName; People.MobilePhone = place.MobilePhone; People.CompanyName = place.PlaceName; People.BusinessPhone = place.PlacePhone; People.HomePhone = place.HomePhone; People.Emails = place.Emails; People.AddressLine1 = place.AddressLine1; People.AddressLine2 = place.AddressLine2; People.City = place.City; People.State = place.State; People.Country = place.Country; People.ZipCode = place.ZipCode; People.CategoryID = 0; People.IsDeleted = false; People.CreatedDate = DateTime.UtcNow; People.UpdatedDate = DateTime.UtcNow; //Market Market = new Market(); //Market.MarketGUID = Guid.NewGuid(); //Market.IsDefault = true; //Market.UserGUID = Place.UserGUID; //Market.EntityType = 1; //Market.OrganizationGUID = Place.OrganizationGUID; //Market.OwnerGUID = Place.PlaceGUID; //Market.MarketName = Place.PlaceName; //Market.PrimaryContactGUID = People.PeopleGUID; //Market.FirstName = place.FirstName; //Market.LastName = place.LastName; //Market.MobilePhone = place.MobilePhone; //Market.MarketPhone = place.PlacePhone; //Market.HomePhone = place.HomePhone; //Market.Emails = place.Emails; //Market.AddressLine1 = place.AddressLine1; //Market.AddressLine2 = place.AddressLine2; //Market.City = place.City; //Market.State = place.State; //Market.Country = place.Country; //Market.ZipCode = place.ZipCode; //Market.IsDeleted = false; //Market.CreateDate = DateTime.UtcNow; //Market.UpdatedDate = DateTime.UtcNow; int placeInsertResult = _IPlaceRepository.InsertPlace(Place); //int placeInsertResult = _IPlaceRepository.Save(); if (placeInsertResult > 0) { int peopleInsertResult = _IPeopleRepository.InsertPeople(People); // int peopleInsertResult = _IPeopleRepository.Save(); if (peopleInsertResult > 0) { //_IMarketRepository.InsertMarket(Market); //int marketInsertResult = _IMarketRepository.Save(); //if (marketInsertResult > 0) //{ return(RedirectToAction("Index")); //} //else //{ // _IMarketRepository.DeleteMarket(Market.MarketGUID); // _IMarketRepository.Save(); // _IPeopleRepository.DeletePeople(People.PeopleGUID); // _IPeopleRepository.Save(); // _IPlaceRepository.DeletePlace(Place.PlaceGUID); // _IPlaceRepository.Save(); //} } else { _IPeopleRepository.DeletePeople(People.PeopleGUID); // _IPeopleRepository.Save(); _IPlaceRepository.DeletePlace(Place.PlaceGUID); //_IPlaceRepository.Save(); } } else { _IPlaceRepository.DeletePlace(Place.PlaceGUID); // _IPlaceRepository.Save(); } } else { TempData["msg"] = "<script>ModalPopupsAlert('Workers-In-Motion','Client ID already configured');</script>"; return(View(place)); } } else { return(View(place)); } return(View()); } else { return(RedirectToAction("SessionTimeOut", "User")); } } catch (Exception ex) { Logger.Error(ex.Message); return(View(place)); } }