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()); }
public bool InsertUpdateBiddingDetails(BiddingProfile bidding, out long identity, out string message) { int rowEffected = 0; using (DBConnector connector = new DBConnector("Usp_InsertBidding", true)) { List <BiddinguserType> userType = new List <BiddinguserType>(); foreach (var details in bidding.biddingDetails) { userType.Add(new BiddinguserType() { vehicleno = details.vehicleno, capacity = details.capacity }); } connector.AddInParameterWithValue("@biddingid", bidding.biddingid); connector.AddInParameterWithValue("@dtlpostingid", bidding.dtlpostingid); connector.AddInParameterWithValue("@userid", bidding.userid); connector.AddInParameterWithValue("@amount", bidding.amount); connector.AddInParameterWithValue("@biddercomment", bidding.biddercomment); connector.AddInParameterWithValue("@status", bidding.status); connector.AddInParameterWithValue("@servicecharges", bidding.servicecharges); connector.AddInParameterWithValue("@paymentmethod", bidding.paymentmethod); connector.AddInParameterWithValue("@rating", bidding.rating); connector.AddInParameterWithValue("@cancellationreason", bidding.cancellationreason); connector.AddInParameterWithValue("@biddingDetails", DataAccessUtility.ToDataTable <BiddinguserType>(userType)); connector.AddOutParameterWithType("@identity", SqlDbType.BigInt); connector.AddOutParameterWithType("@Message", SqlDbType.VarChar); rowEffected = connector.ExceuteNonQuery(); message = connector.GetParamaeterValue("@Message").ToString(); identity = bidding.biddingid == 0 ? Convert.ToInt64(connector.GetParamaeterValue("@identity")) : bidding.biddingid; } return(rowEffected > 0); }
public ResponseSingleModel <BiddingProfile> BiddingSubmition(BiddingProfile bidding, out string message) { ResponseSingleModel <BiddingProfile> response = new ResponseSingleModel <BiddingProfile>(); long biddingId = 0; message = string.Empty; if (this.instanceBidding.InsertUpdateBiddingDetails(bidding, out biddingId, out message)) { bidding.biddingid = biddingId; foreach (var details in bidding.biddingDetails) { details.biddingid = biddingId; } response.Response = bidding; response.Message = message; response.Status = Constants.WebApiStatusOk; } else { response.Message = message; response.Status = Constants.WebApiStatusFail; } return(response); }
public ResponseSingleModel <BiddingProfile> GetBiddingDetailById(long biddingId) { var response = new ResponseSingleModel <BiddingProfile>(); var ds = this.instanceBidding.GetById(biddingId); BiddingProfile biddingProfile = DataAccessUtility.ConvertToList <BiddingProfile>(ds.Tables[0])[0]; biddingProfile.biddingDetails = DataAccessUtility.ConvertToList <BiddingDetails>(ds.Tables[1]); response.Response = biddingProfile; response.Status = Constants.WebApiStatusOk; return(response); }
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 })); } }
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()); }