public int Insert(OrgUserModel model) { string sql = "INSERT INTO [OrgUser]([UserID],[OrgID]) VALUES(@UserID,@OrgID)"; SqlParameter[] parameters = { new SqlParameter("@UserID", SqlDbType.VarChar), new SqlParameter("@OrgID", SqlDbType.Int), }; parameters[0].Value = model.UserID; parameters[1].Value = model.OrgID; return(DbHelperSQL.ExecuteSql(sql, parameters)); }
public int Update(OrgUserModel model) { string sql = "UPDATE [OrgUser] SET [UserID]=@UserID,[OrgID]=@OrgID WHERE UserID=@UserID and OrgID=@OrgID"; SqlParameter[] parameters = { new SqlParameter("@UserID", SqlDbType.VarChar), new SqlParameter("@OrgID", SqlDbType.Int), }; parameters[0].Value = model.UserID; parameters[1].Value = model.OrgID; return(DbHelperSQL.ExecuteSql(sql, parameters)); }
public JsonResult Update(OrgUserViewModel model) { try { OrgUserModel orgUserModel = orgUserBll.GetModel(model.UserID, model.OrgID); orgUserModel.UserID = model.UserID; orgUserModel.OrgID = model.OrgID; orgUserBll.Update(orgUserModel); return(Json(new { code = 200 })); } catch (Exception ex) { return(Json(new { code = 500, msg = ex.Message })); } }
public JsonResult Insert(OrgUserViewModel model) { try { OrgUserModel orgUserModel = new OrgUserModel(); orgUserModel.UserID = model.UserID; orgUserModel.OrgID = model.OrgID; orgUserBll.Insert(orgUserModel); return(Json(new { code = 200 })); } catch (Exception ex) { return(Json(new { code = 500, msg = ex.Message })); } }
public OrgUserModel DataRowToModel(DataRow row) { OrgUserModel model = new OrgUserModel(); if (row == null) { return(model); } if (row["UserID"] != null && row["UserID"].ToString() != "") { model.UserID = row["UserID"].ToString(); } if (row["OrgID"] != null && row["OrgID"].ToString() != "") { model.OrgID = int.Parse(row["OrgID"].ToString()); } return(model); }
public JsonResult Delete(string userID, int orgID) { try { OrgUserModel model = orgUserBll.GetModel(userID, orgID); if (model != null) { orgUserBll.Delete(userID, orgID); } else { return(Json(new { code = 500, msg = "parms is null" })); } return(Json(new { code = 200 })); } catch (Exception ex) { return(Json(new { code = 500, msg = ex.Message })); } }
public int Update(OrgUserModel model) { return(dal.Update(model)); }
public int Insert(OrgUserModel model) { return(dal.Insert(model)); }