public void Add(int trackId)
 {
     _addTrackProperty = new AddPropertyViewModel(trackId, AddEditPropertyType.Track);
     if (_addTrackProperty.Properties.Count == 0)
     {
         ShowMessageBox("No more available properties, please edit the existing ones", "Cannot add property", MessageBoxOptions.Ok);
         _addTrackProperty.TryClose();
     }
     else
     {
         _addTrackProperty.Deactivated += _addTrackProperty_Deactivated;
         ShowDialog(_addTrackProperty);
     }
 }
Ejemplo n.º 2
0
 public void Add()
 {
     _addCriteria = new AddPropertyViewModel(_playList.Id, AddEditPropertyType.SearchCriteria);
     if (_addCriteria.Properties.Count == 0)
     {
         ShowMessageBox("No more available criteria, please edit the existing ones", "Cannot add criteria", MessageBoxOptions.Ok);
         _addCriteria.TryClose();
     }
     else
     {
         _addCriteria.Deactivated += _addCriteria_Deactivated;
         ShowDialog(_addCriteria);
     }
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> Add(AddPropertyViewModel property)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string flag = "";
                    HttpContext.Request.Cookies.TryGetValue("CurrentUser", out flag);
                    if (string.IsNullOrEmpty(flag))
                    {
                        return(RedirectToAction(nameof(SellerController.Login), "Seller"));
                    }
                    else
                    {
                        Seller   cur = JsonConvert.DeserializeObject <Seller>(flag);
                        Property p   = new Property
                        {
                            Title       = property.Title,
                            Location    = property.Location,
                            Rooms       = property.Rooms,
                            BathRooms   = property.BathRooms,
                            CarParkings = property.CarParkings,
                            Type        = property.Type,
                            FloorArea   = property.FloorArea,
                            LandArea    = property.LandArea,
                            RV          = property.RV,
                            Email       = property.Email,
                            Seller_Id   = cur.Id
                        };
                        this._context.Properties.Add(p);
                        await this._context.SaveChangesAsync();

                        return(RedirectToAction(nameof(SellerController.Property), "Seller"));
                    }
                }
                catch (Exception ex)
                {
                    HttpContext.Response.Cookies.Append("IsSuccess", "false");
                    HttpContext.Response.Cookies.Append("Messages", ex.Message);
                    HttpContext.Response.Cookies.Append("IsRegister", "false");
                    HttpContext.Response.Cookies.Append("Info", "Woops, Add Property Failed!");
                    return(RedirectToAction(nameof(SellerController.Result), "Seller"));
                }
            }
            return(View());
        }
Ejemplo n.º 4
0
 public AddPropertyPage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     BindingContext = new AddPropertyViewModel(Navigation);
 }