public IHttpActionResult Post(TMS_Advertise_Cash tmsAdvertiseCash) { if (tmsAdvertiseCash == null) { return(Json(new { Msg = "0" })); } if (!tmsAdvertiseCash.AccountId.HasValue) { return(Json(new { Msg = "0", Reason = "Account Id field cannot be empty!" })); } if (!tmsAdvertiseCash.CurrencyId.HasValue) { return(Json(new { Msg = "0", Reason = "Currency Id field cannot be empty!" })); } 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.BidStartDate.HasValue) { return(Json(new { Msg = "0", Reason = "Bid Start Date field cannot be empty!" })); } if (!tmsAdvertiseCash.BidEndDate.HasValue) { return(Json(new { Msg = "0", Reason = "Bid End Date field cannot be empty!" })); } if (tmsAdvertiseCash.CurrentStage == String.Empty) { return(Json(new { Msg = "0", Reason = "Current Stage field cannot be empty!" })); } if (tmsAdvertiseCash.Notes == String.Empty) { return(Json(new { Msg = "0", Reason = "Note field cannot be empty!" })); } try { int s = _objAdvertiseCashBll.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 int Update(TMS_Advertise_Cash tmsAdvertiseCash) { int d = _repository.Update(tmsAdvertiseCash); return(d); }
public int Insert(TMS_Advertise_Cash tmsAdvertiseCash) { return(_repository.Insert(tmsAdvertiseCash)); }
public IHttpActionResult UpdateAdvertiseCash(int id, TMS_Advertise_Cash tmsAdvertiseCash) { if (!tmsAdvertiseCash.AccountId.HasValue) { return(Json(new { Msg = "0", Reason = "Account Id field cannot be empty!" })); } if (!tmsAdvertiseCash.CurrencyId.HasValue) { return(Json(new { Msg = "0", Reason = "Currency Id field cannot be empty!" })); } 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.BidStartDate.HasValue) { return(Json(new { Msg = "0", Reason = "Bid Start Date field cannot be empty!" })); } if (!tmsAdvertiseCash.BidEndDate.HasValue) { return(Json(new { Msg = "0", Reason = "Bid End Date field cannot be empty!" })); } if (tmsAdvertiseCash.CurrentStage == String.Empty) { return(Json(new { Msg = "0", Reason = "Current Stage field cannot be empty!" })); } if (tmsAdvertiseCash.Notes == String.Empty) { return(Json(new { Msg = "0", Reason = "Note field cannot be empty!" })); } 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 = _objAdvertiseCashBll.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; } } }