public async Task AddProductTypeMaster(GiProductTypeMaster prodData) { var maxId = await WithConnection(async c => { return(await c.QueryAsync <int>("SELECT max(GITypeIndex) FROM GI_ProductTypeMaster")); }); //Setting Primary Key if (maxId.SingleOrDefault() == 0) { prodData.GITypeIndex = 1; } else { prodData.GITypeIndex = 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.InsertProductTypeMaster, prodData)); }); }
public async Task <IHttpActionResult> Create(GiProductTypeMaster prodData) { if (prodData != null) { await giProductTypeMasterDA.AddProductTypeMaster(prodData); return(Ok()); } return(BadRequest("Request cannot be NULL")); }