Ejemplo n.º 1
0
        public ActionResult Edit(int id, BiddingProfile profile)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string message = string.Empty;
                    profile.biddingid = id;
                    BiddingRepository repository = new BiddingRepository(this.UserId);
                    //Perform the conversion and fetch the destination view model
                    var profileresult = repository.BiddingSubmition(profile, out message);
                    if (profileresult.Response != null)
                    {
                        ViewBag.Message = "Successfully updated";
                    }
                    else
                    {
                        ViewBag.Message = "Updation fail.";;
                    }
                }
            }
            catch (Exception exp)
            {
                ////TODO: log the error
                ViewBag.Message = "Unexpected error occured";
            }

            return(View());
        }
Ejemplo n.º 2
0
        public IHttpActionResult SubmitBidding(BiddingProfile posting)
        {
            string message = string.Empty;

            using (var repository = new BiddingRepository(posting.userid))
            {
                var result = repository.BiddingSubmition(posting, out message);
                if (!string.IsNullOrEmpty(message))
                {
                    log.Info(message);
                }

                return(Ok(new { result.Status, data = result }));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Create(FormCollection form, BiddingProfile profile)
        {
            try
            {
                //the form values becomes comma delimited array when it come to server side
                string[] no       = form["VehicleNo"].Split(char.Parse(","));
                string[] capacity = form["capacity"].Split(char.Parse(","));

                //process values
                List <BiddingDetails> biddingDetailslist = new List <BiddingDetails>();

                for (int i = 0; i < no.Length; i++)
                {
                    BiddingDetails bd = new BiddingDetails();
                    bd.vehicleno = Convert.ToInt16(no[i]);
                    bd.capacity  = Convert.ToInt16(capacity[i]);
                    biddingDetailslist.Add(bd);
                }

                if (ModelState.IsValid)
                {
                    var message = string.Empty;
                    BiddingRepository repository = new BiddingRepository(this.UserId);
                    profile.biddingDetails = biddingDetailslist;
                    //Perform the conversion and fetch the destination view model
                    var profileresult = repository.BiddingSubmition(profile, out message);
                    if (profileresult.Response != null)
                    {
                        ViewBag.Message = message;
                    }
                    else
                    {
                        ViewBag.MessageFail = message;
                    }
                }
            }
            catch (Exception exp)
            {
                ////TODO: log the error
                ViewBag.Message = "Unexpected error occured";
            }

            return(View());
        }