public void Post([FromBody] MemberLedger memberLedger) { if (ModelState.IsValid) { MemberLedgerRipository.Add(memberLedger); } }
public void Put(int id, [FromBody] MemberLedger memberLedger) { memberLedger.Id = id; if (ModelState.IsValid) { MemberLedgerRipository.Update(memberLedger); } }
public void Update(MemberLedger cust) { using (IDbConnection dbConnection = Connection) { string sQuery = "UPDATE MemberLedger SET Date = @Date," + " LedgerNo = @LedgerNo, Label = @Label," + " Debit = @Debit, Credit = @Credit,MemberID=@MemberID" + " WHERE Id = @Id"; dbConnection.Open(); dbConnection.Query(sQuery, cust); } }
public void Add(MemberLedger memberLedger) { var Date = System.Convert.ToDateTime(memberLedger.Date); using (IDbConnection dbConnection = Connection) { string sQuery = " INSERT INTO MemberLedger (Date, LedgerNo, Label, Debit,Credit,MemberID)" + " VALUES(@Date, @LedgerNo, @Label, @Debit,@Credit,@MemberID)"; dbConnection.Open(); dbConnection.Query(sQuery, memberLedger); } }
public IEnumerable <MemberLedger> CardDetail(List <Member> List) { MemberLedger MemberL = null; List <MemberLedger> MemberCardList = new List <MemberLedger>(); foreach (var Id in List) { MemberL = new MemberLedger(); using (IDbConnection dbConnection = Connection) { string sQuery = " SELECT RTRIM(Member.MemberID) As MemberID,Member.ContactNo ,RTRIM(Name) As Name,IsNull(sum(Credit)-sum(Debit),0)As Credit FROM Member left join MemberLedger on Member.MemberID=MemberLedger.MemberID where Member.MemberID=" + Id + " group by name, Member.ContactNo,Member.MemberID order by Name"; dbConnection.Open(); SqlDataReader dr = (SqlDataReader)dbConnection.ExecuteReader(sQuery); MemberCardList.Add(MemberL); } } return(MemberCardList); }
public ActionResult DeleteMember(MemberLedger MemberLedger) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(Baseurl); client.DefaultRequestHeaders.Clear(); //Define request data format client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); //Sending request to find web api REST service resource GetAllEmployees using HttpClient HttpResponseMessage Res = client.DeleteAsync("api/MemberLedger/" + MemberLedger.MemberID).Result; //Checking the response is successful or not which is sent using HttpClient if (Res.IsSuccessStatusCode) { //Storing the response details recieved from web api var CatResponse = Res.Content.ReadAsStringAsync().Result; ViewBag.Name = JsonConvert.SerializeObject(CatResponse); //Deserializing the response recieved from web api and storing into the Employee list //CatInfo = JsonConvert.DeserializeObject<List<Category>>(CatResponse); } } return(RedirectToAction("GetAFund")); }