public string DeleteTestType(TestTypeViewModel objTestType) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("TestTypeID", objTestType.TestTypeID)); return(DGeneric.RunSP_ExecuteNonQuery("sp_DeleteTestType", sqlParameterList)); }
public static TestTypeViewModel ById(long id) { TestTypeViewModel result = new TestTypeViewModel(); using (var db = new XBC_Context()) { result = (from ttp in db.t_test_type join us in db.t_user on ttp.created_by equals us.id where ttp.id == id && ttp.is_delete == false select new TestTypeViewModel { id = ttp.id, name = ttp.name, notes = ttp.notes, typeofanswer = ttp.type_of_answer, createdBy = ttp.created_by, CreatedByName = us.username }).FirstOrDefault(); if (result == null) { result = new TestTypeViewModel(); } } return(result); }
public ActionResult Delete(TestTypeViewModel model) { ResponseResult result = TestTypeRepo.Delete(model); return(Json(new { success = result.Success, message = result.ErrorMessage, entity = result.Entity }, JsonRequestBehavior.AllowGet)); }
public static ResponseResult Delete(TestTypeViewModel entity) { ResponseResult result = new ResponseResult(); using (var db = new XBC_Context()) { t_test_type ttp = db.t_test_type.Where(o => o.id == entity.id).FirstOrDefault(); if (ttp != null) { var json = new JavaScriptSerializer().Serialize(ttp); t_audit_log log = new t_audit_log(); log.type = "Modify"; log.json_before = json; log.created_by = entity.UserId; log.created_on = DateTime.Now; ttp.is_delete = true; ttp.deleted_by = entity.UserId; ttp.deleted_on = DateTime.Now; var json2 = new JavaScriptSerializer().Serialize(ttp); log.json_after = json2; db.t_audit_log.Add(log); db.SaveChanges(); result.Entity = entity; } else { result.Success = false; result.ErrorMessage = "Test Type not found!"; } } return(result); }
public string DeleteTestType(TestTypeViewModel objTestType) { return(_iDTestType.DeleteTestType(objTestType)); }
public string AddUpdateTestType(TestTypeViewModel objTestType) { return(_iDTestType.AddUpdateTestType(objTestType)); }
public HttpResponseMessage DeleteTestType(TestTypeViewModel objTestType) { return(Request.CreateResponse(HttpStatusCode.OK, _iBTestType.DeleteTestType(objTestType))); }
public static ResponseResult Update(TestTypeViewModel entity) { ResponseResult result = new ResponseResult(); using (var db = new XBC_Context()) { if (entity.id == 0) { t_test_type tstp = new t_test_type(); tstp.name = entity.name; tstp.notes = entity.notes; tstp.created_by = entity.UserId; tstp.created_on = DateTime.Now; tstp.is_delete = false; db.t_test_type.Add(tstp); db.SaveChanges(); var json = new JavaScriptSerializer().Serialize(tstp); t_audit_log log = new t_audit_log(); log.type = "Insert"; log.json_insert = json; log.created_by = entity.UserId; log.created_on = DateTime.Now; db.t_audit_log.Add(log); db.SaveChanges(); entity.id = tstp.id; result.Entity = entity; } else //edit { t_test_type tstp = db.t_test_type.Where(ttp => ttp.id == entity.id).FirstOrDefault(); if (tstp != null) { var json = new JavaScriptSerializer().Serialize(tstp); t_audit_log log = new t_audit_log(); log.type = "Modify"; log.json_before = json; log.created_by = entity.UserId; log.created_on = DateTime.Now; tstp.name = entity.name; tstp.notes = entity.notes; tstp.modified_by = entity.UserId; tstp.modified_on = DateTime.Now; var json2 = new JavaScriptSerializer().Serialize(tstp); log.json_after = json2; db.t_audit_log.Add(log); db.SaveChanges(); result.Entity = entity; } else { result.Success = false; result.ErrorMessage = "Test Type not found"; } } } return(result); }