public IHttpActionResult Post(TMS_Auction_Settings tmsAdvertiseCash)
        {
            if (tmsAdvertiseCash == null)
            {
                return(Json(new { Msg = "0" }));
            }

            if (!tmsAdvertiseCash.AdvertAmount.HasValue)
            {
                return(Json(new { Msg = "0", Reason = "Advert Amount field cannot be empty!" }));
            }
            if (!tmsAdvertiseCash.SellingPrice.HasValue)
            {
                return(Json(new { Msg = "0", Reason = "Selling Price field cannot be empty!" }));
            }
            if (!tmsAdvertiseCash.Bidsstartdate.HasValue)
            {
                return(Json(new { Msg = "0", Reason = "Bids start date field cannot be empty!" }));
            }
            if (tmsAdvertiseCash.CurrentStage == String.Empty)
            {
                return(Json(new { Msg = "0", Reason = "Current Stage field cannot be empty!" }));
            }
            if (tmsAdvertiseCash.Description == String.Empty)
            {
                return(Json(new { Msg = "0", Reason = "Note field cannot be empty!" }));
            }

            //assign default values before inserting
            tmsAdvertiseCash.CreationDate = DateTime.Now;

            try
            {
                int s = _objAuctionSettingBll.Insert(tmsAdvertiseCash);
                if (s == 1)
                {
                    return(Json(new { Msg = "1" }));
                }
                return(Json(new { Msg = "0" }));
            }
            catch (DbUpdateConcurrencyException)
            {
                return(Json(new { Msg = "0", Reason = "No row affected!" }));
            }
        }
        public IHttpActionResult UpdateAuctionSetting(int id, TMS_Auction_Settings tmsAdvertiseCash)
        {
            if (!ModelState.IsValid)
            {
                //return BadRequest(ModelState);
                return(Json(new { Msg = "0" }));
            }

            if (id != tmsAdvertiseCash.Id)
            {
                //return BadRequest();
                return(Json(new { Msg = "0" }));
            }

            try
            {
                int s = _objAuctionSettingBll.Update(tmsAdvertiseCash);
                if (s == 1)
                {
                    return(Json(new { Msg = "1" }));
                }
                return(Json(new { Msg = "0" }));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TmsAdvertiseCashExists(id))
                {
                    //return NotFound();
                    return(Json(new { Msg = "0", Reason = "No row affected!" }));
                }
                else
                {
                    throw;
                }
            }
        }
 public int Insert(TMS_Auction_Settings tmsDisbursment)
 {
     return(_repository.Insert(tmsDisbursment));
 }
 public int Update(TMS_Auction_Settings tmsAuctionSettings)
 {
     return(_repository.Update(tmsAuctionSettings));
 }