public static async Task <e.shared.ActionResult> Update(e.confirm_record obj) { using (var db = d.ConnectionFactory()) { obj.modified_date = DateTime.Now; await db.ExecuteAsync(d.Update <e.confirm_record>(), obj); return(new e.shared.ActionResult { Status = e.shared.Status.Success }); } }
public static async Task <e.shared.ActionResult> Insert(e.confirm_record obj) { using (var db = d.ConnectionFactory()) { obj.creation_date = DateTime.Now; obj.modified_date = DateTime.Now; int id = await db.ExecuteScalarAsync <int>(d.InsertAutoId <e.confirm_record>(), obj); return(new e.shared.ActionResult { Status = e.shared.Status.Success, Value = id }); } }
public void CRUD() { e.confirm_record obj = new e.confirm_record() { quarantine_id = null, station_id = null, patient_name = "test name", patient_nrc = "test nrc", patient_ph = "test phone", patient_age = "test age", patient_dob = DateTime.Now, gender = "male", hometown = "test home town", reason_id = null, travel_history = "travel history", residence_address = "resident history", current_address = "current address", traveled_from = "travel from", fever_history = "fever history", remark = "Remark", result_date = DateTime.Now, result = "test result" }; //Create e.shared.ActionResult insert_result = d.confirm_record.Insert(obj).Result; //Read obj = d.confirm_record.Get(int.Parse(insert_result.Value.ToString())).Result; //Read all IEnumerable <e.confirm_record> objs = d.confirm_record.Get().Result; //Update obj.patient_name = "testing update"; e.shared.ActionResult update_result = d.confirm_record.Update(obj).Result; //Delete e.shared.ActionResult delete_result = d.confirm_record.Delete(int.Parse(insert_result.Value.ToString())).Result; }