public bool InsertUpdatePosting(PostingProfile posting, out long identity, out string message) { int rowEffected = 0; using (DBConnector connector = new DBConnector("Usp_InsertUpdatePosting", true)) { connector.AddInParameterWithValue("@PostingId", posting.postingid); connector.AddInParameterWithValue("@PostType", posting.posttype); connector.AddInParameterWithValue("@UserId", posting.userid); connector.AddInParameterWithValue("@SoureAddress", posting.soureaddress); connector.AddInParameterWithValue("@DestinationAdress", posting.destinationadress); connector.AddInParameterWithValue("@MaterialTypeId", posting.materialtypeid); connector.AddInParameterWithValue("@Description", posting.description); connector.AddInParameterWithValue("@PackageTypeId", posting.packagetypeid); connector.AddInParameterWithValue("@PackageTypeDesc", posting.packagetypedesc); connector.AddInParameterWithValue("@src_state", posting.src_state); connector.AddInParameterWithValue("@src_city", posting.src_city); connector.AddInParameterWithValue("@src_pincode", posting.src_pincode); connector.AddInParameterWithValue("@src_landmark", posting.src_landmark); connector.AddInParameterWithValue("@dst_state", posting.dst_state); connector.AddInParameterWithValue("@dst_city", posting.dst_city); connector.AddInParameterWithValue("@dst_pincode", posting.dst_pincode); connector.AddInParameterWithValue("@dst_landmark", posting.dst_landmark); connector.AddOutParameterWithType("@identity", SqlDbType.BigInt); connector.AddOutParameterWithType("@Message", SqlDbType.VarChar); rowEffected = connector.ExceuteNonQuery(); message = connector.GetParamaeterValue("@Message").ToString(); identity = posting.postingid == 0 ? Convert.ToInt64(connector.GetParamaeterValue("@identity")): posting.postingid; } return(rowEffected > 0); }
public IHttpActionResult SubmitPosting(PostingProfile posting) { string message = string.Empty; using (var repository = new PostingRepository(posting.userid)) { var result = repository.PostingPorfileCreation(posting, out message); if (!string.IsNullOrEmpty(message)) { log.Info(message); } return(Ok(new { result.Status, data = result })); } }
public ResponseSingleModel <PostingProfile> PostingPorfileCreation(PostingProfile posting, out string message) { var result = new ResponseSingleModel <PostingProfile>(); long postingId = 0; message = string.Empty; if (this.instance.InsertUpdatePosting(posting, out postingId, out message)) { posting.postingid = postingId; result.Response = posting; result.Status = Constants.WebApiStatusOk; result.Message = message; } else { result.Status = Constants.WebApiStatusFail; result.Message = message; } return(result); }
public ResponseSingleModel <PostingDetails> GetPostingDetailByPostId(long postingId, out PostingProfile profile, out string message) { var result = new ResponseSingleModel <PostingDetails>(); message = string.Empty; PostingDetails postingDetails = null; var ds = this.instance.GetByPostingDetailsId(postingId, out message); var dsPhotos = this.instance.GetByPostingPhotosById(postingId, out message); var lstPostingPhotos = DataAccessUtility.ConvertToList <PostingPhotos>(dsPhotos.Tables[0]); var lstProfile = DataAccessUtility.ConvertToList <PostingProfile>(ds.Tables[0]); var lstDetails = DataAccessUtility.ConvertToList <PostingDetails>(ds.Tables[1]); profile = lstProfile.Count > 0 ? lstProfile[0] : null; postingDetails = lstDetails.Count > 0 ? lstDetails[0] : null; postingDetails.PostingPhotoList = lstPostingPhotos; result.Response = postingDetails; result.Status = Constants.WebApiStatusOk; result.Message = message; return(result); }