/// <summary> /// Insert a row /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Category_Insert(Category entity) { return _categoryDal.Category_Insert(entity) > 0; }
/// <summary> /// Update a row /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Category_Update(Category entity) { return _categoryDal.Category_Update(entity); }
/// <summary> /// Update a row /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Category_Update(Category entity) { using (SqlConnection conn = new SqlConnection(AppConfiguration.ConnectionString)) { SqlCommand command = new SqlCommand("Category_Update", conn); command.CommandType = CommandType.StoredProcedure; try { command.Parameters.Add(new SqlParameter("@Category_Id", SqlDbType.UniqueIdentifier)); command.Parameters["@Category_Id"].Value = entity.Category_Id; command.Parameters.Add(new SqlParameter("@Category_Name", SqlDbType.NVarChar)); command.Parameters["@Category_Name"].Value = entity.Category_Name; command.Parameters.Add(new SqlParameter("@Category_IsDelete", SqlDbType.Bit)); command.Parameters["@Category_IsDelete"].Value = entity.Category_IsDelete; conn.Open(); return command.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { command.Dispose(); } } }