public ActionResult AdPreApproval(int id, BankApprovalView model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    BankApproval newModel = new BankApproval
                    {
                        AuctionRegistrationID = id,
                        DateOfSubmision       = DateTime.Now
                    };
                    newModel.ApprovalPath = FileController.PostFile(model.ApprovalPath, "bankapprovals", "bankapprovals");

                    //Call Post Method
                    APIMethods.APIPost <BankApproval>(newModel, "BankApprovals");

                    int propID = APIMethods.APIGet <AuctionRegistration>(id.ToString(), "AuctionRegistrations").PropertyID;


                    return(RedirectToAction("Detailss", "home", new { id = propID }));
                }
                catch (Exception E)
                {
                    throw new Exception("Something went wrong. Please try again" + E.Message);
                }
            }
            else
            {
                return(View(model));
            }
        }
        // GET: Buyers
        public ActionResult Index(RegisteredBuyer model)
        {
            if (ModelState.IsValid)
            {
                return(View());
            }
            else
            {
                try
                {
                    RegisteredBuyer buyer = APIMethods.APIGet <RegisteredBuyer>(User.Identity.GetUserId(), "RegisteredBuyers");

                    return(View(buyer));
                }
                catch (Exception E)
                {
                    if (User.Identity.IsAuthenticated)
                    {
                        return(RedirectToAction("Create", "Buyers", new { id = 0 }));
                    }
                    else
                    {
                        return(RedirectToAction("Login", "Account"));
                    }
                }
            }
        }
        public ActionResult AddBankGuarintee(int id, GuarinteeViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Guarintee newModel = new Guarintee
                    {
                        AuctionRegistrationID = id,
                        DateOfSubmition       = DateTime.Now
                    };
                    newModel.GuarinteePath = FileController.PostFile(model.GuarinteePath, "Guarintees", "guarintees");

                    //Call Post Method
                    APIMethods.APIPost <Guarintee>(newModel, "Guarintees");

                    int propID = APIMethods.APIGet <AuctionRegistration>(id.ToString(), "AuctionRegistrations").PropertyID;

                    return(RedirectToAction("Detailss", "home", new { id = propID }));
                }
                catch (Exception E)
                {
                    throw new Exception("Something went wrong. Please try again" + E.Message);
                }
            }
            else
            {
                return(View(model));
            }
        }
Ejemplo n.º 4
0
        // GET: AuctionRoom
        public ActionResult Index(int id)
        {
            if (User.Identity.IsAuthenticated)
            {
                try
                {
                    List <AuctionRegistration> reglys = APIMethods.APIGetALL <List <AuctionRegistration> >("AuctionRegistrations");

                    Property model = APIMethods.APIGet <Property>(id.ToString(), "Properties");


                    foreach (AuctionRegistration reg in reglys)
                    {
                        if (model.PropertyID == reg.PropertyID && reg.BuyerId == User.Identity.GetUserId())
                        {
                            return(View(model));
                        }
                    }
                    return(RedirectToAction("RegisterForAuction", "Buyers", new { id = model.PropertyID }));
                }
                catch (Exception E)
                {
                    return(RedirectToAction("Create", "Buyers", new { id = 0 }));
                }
            }
            else
            {
                return(RedirectToAction("login", "account"));
            }
        }
 public ActionResult Details(int id, Property model)
 {
     if (ModelState.IsValid)
     {
         return(View());
     }
     else
     {
         return(View(APIMethods.APIGet <Property>(id.ToString(), "Properties")));
     }
 }
Ejemplo n.º 6
0
 public ActionResult DetailsID(int id)
 {
     try
     {
         Property prop = APIMethods.APIGet <Property>(id.ToString(), "Properties");
         return(View(prop));
     }
     catch (Exception E)
     {
         ErrorViewModel error = new ErrorViewModel()
         {
             msge = E.ToString(),
         };
         return(RedirectToAction("ErrorView", "Home", error));
     }
 }
 // GET: SellersAccount/Edit/5
 public ActionResult Delete(int id, Property model)
 {
     if (model.PropertyID != 0)
     {
         try
         {
             APIMethods.APIDelete <Property>(model.PropertyID.ToString(), "Properties");
             return(RedirectToAction("Index"));
         }
         catch (Exception E)
         {
             throw new Exception(E.ToString());
         }
     }
     else
     {
         return(View(APIMethods.APIGet <Property>(id.ToString(), "Properties")));
     }
 }
        // GET: SellersAccount/Edit/5

        public ActionResult Edit(int id, Property model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    APIMethods.APIPut <Property>(model, id.ToString(), "Properties");
                    return(RedirectToAction("Index"));
                }
                catch (Exception E)
                {
                    throw new Exception(E.ToString());
                }
            }
            else
            {
                return(View(APIMethods.APIGet <Property>(id.ToString(), "Properties")));
            }
        }
        public ActionResult Index(Seller model)
        {
            if (ModelState.IsValid)
            {
                return(View());
            }
            else
            {
                try
                {
                    Seller sellerModel = APIMethods.APIGet <Seller>(User.Identity.GetUserId(), "Sellers");

                    return(View(sellerModel));
                }
                catch (Exception E)
                {
                    return(View());
                }
            }
        }
        public ActionResult Index(Seller model)
        {
            if (ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                string userId = User.Identity.GetUserId();
                Seller seller = APIMethods.APIGet <Seller>(userId, "Seller");

                return(View(seller));
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                return(View());
            }
        }