public async Task AddBranchMaster(BranchMaster prodData) { var maxId = await WithConnection(async c => { return await c.QueryAsync<int>("SELECT max(Branch_ID) FROM BranchMaster"); }); //Setting Primary Key if (maxId.SingleOrDefault() == 0) { prodData.Branch_ID = 1; } else { prodData.Branch_ID = maxId.SingleOrDefault() + 1; } //Filling Other Records like User Id, Creation & Update Date prodData.CreateUserIndex = 1; //Later Logged in User prodData.UpdateUserIndex = 1; //Later Logged in User prodData.CreateDateTime = DateTime.Now; prodData.UpdateDateTime = DateTime.Now; await WithConnection(async c => { return await c.QueryAsync<int>(SQLConstants.InsertBranchMaster, prodData); }); }
public async Task<IHttpActionResult> Create(BranchMaster prodData) { if (prodData != null) { await BranchDA.AddBranchMaster(prodData); return Ok(); } return BadRequest("Request cannot be NULL"); }
public async Task<IHttpActionResult> Delete(BranchMaster prodData) { if (prodData != null) { await BranchDA.DeleteBranchMaster(prodData); return Ok("Index"); } return BadRequest("Request cannot be NULL"); }
public async Task DeleteBranchMaster(BranchMaster prodData) { //Filling Other Records like User Id, Creation & Update Date prodData.UpdateUserIndex = 1; //Later Logged in User prodData.UpdateDateTime = DateTime.Now; await WithConnection(async c => { return await c.QueryAsync<int>(SQLConstants.DeleteBranchMaster, prodData); }); }